in reply to Re^2: UTF8 Validityin thread UTF8 Validity
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); [download]