Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^5: How to Encode/Decode double encoded string.

by haj (Curate)
on Sep 22, 2020 at 11:45 UTC ( #11122078=note: print w/replies, xml ) Need Help??

in reply to Re^4: How to Encode/Decode double encoded string.
in thread How to Encode/Decode double encoded string.

If your database actually contains ����, then it will no longer be able to provide the invalid UTF-8 string which was converted to this sequence of replacement characters. So either the legacy version of the application didn't store correct data in the first place, or something went wrong when converting the server encoding to UTF-8. In the latter case, you might be able to grab an old database backup and restart from there.

We don't have access to your database nor to your application, so it is up to you to find out which part of software did the bogus UTF-8-decoding (bogus because it failed to check for errors). In Perl, you can (and should) trap this type of error by catching errors like this:

Use Encode; eval { decode('UTF-8',$string,Encode::FB_CROAK) }; if ($@) { # Well, that $string wasn't a valid UTF-8-string. # Go now and die in what way seems best to you. -- Denethor }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11122078]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2021-01-27 08:12 GMT
Find Nodes?
    Voting Booth?