Just try to decode something as UTF-8. If that fails, fall back to something else.
For example:
$foo = eval { decode("UTF-8", $foo, Encode::FB_CROAK) } || decode("CP1252", $foo);
In reply to Re^3: UTF8 Validity
by Juerd
in thread UTF8 Validity
by menolly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |