- or download this
if there are no bytes with the 8th bit set then
there's no problem -- nevermind
...
the original data is almost certainly utf8
else
the original data is definitely Latin1
- or download this
if any bytes match /[\x80-\x9f]/ then
it's pretty sure not to be Latin1
- or download this
eval "\$_ = decode('utf8',\$orig_data,Encode::FB_CROAK)";
if ($@) {
# it's not utf8, and so must be iso-8859-1
}