... unless of course something isn't hunky-dory to begin with. To quote the Encode man page:
Messing with Perl's InternalsThe following API uses parts of Perl's internals in the current implementation. As such, they are efficient but may change.
...
_utf8_on(STRING)
INTERNAL Turns on the UTF-8 flag in STRING. The data in STRING is not checked for being well-formed UTF-8. Do not use unless you know that the STRING is well-formed UTF-8. Returns the previous state of the UTF-8 flag (so please don't treat the return value as indicating success or failure), or "undef" if STRING is not a string.
(emphasis in the original). If there's any chance that the incoming data might really not be proper utf8, then just treating it as if it were utf8 won't help.
The safer, more stable (non-internal) method for "upgrading" a string to utf8 is covered in the Encode man page above the section quoted here, as is the part about "Handling Malformed Data", which might be relevant to the OP.
In reply to Re: Re: Unicode and Forms
by graff
in thread Unicode and Forms
by mdxi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |