develooper Front page | perl.unicode | Postings from December 2013

Cannot decode string with wide characters

Bill Moseley
December 5, 2013 17:56
Cannot decode string with wide characters
Message ID:
"Cannot decode string with wide characters"

I see this error when calling decode_utf8() on a character string (with
wide characters) that was already decoded.

This error started with Encode 2.53, it seems.  Previous versions appear to
ignore the double decoding.   I assume that means the decode was a noop if
the UTF8 flag was already on.

I'm curious about the change.  Was there a problem with the old behavior,
or was the change to make it more strict?   Or some other problem caused by
double decoding?

I agree that it would be good to be told when double-decoding.

But, I have a situation with a legacy app where decode_utf8 was sprinkled
all over the app because the database DBD was not configured to turn on the
UTF8 flag (pg_enable_utf8).   Turning it on now would be the right approach
and solve some existing encoding issues, but the newer Encode breaks
because of all the existing decode_utf8 calls.

The joys of legacy apps:

$ fgrep  -r 'decode_utf8(' . | wc -l

Bill Moseley Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About