in reply to Can't tell if UTF-8... or just binary...

Maybe Encode::Guess or Encode::Detect can help.
#!/usr/bin/perl use warnings; use strict; use Encode; use Encode::Guess; my $decoder = guess_encoding($content); print "UTF-8" if ref($decoder) eq 'Encode::utf8'; __END__
#!/usr/bin/perl use warnings; use strict; use Encode::Detect::Detector; my $octets = "\x{4f60}\x{597d}\x{4e16}\x{754c}"; my $charset = Encode::Detect::Detector::detect($octets); print "$charset\n"; $octets = "\x82\xb7\x82\xb2\x82\xa2\x82\xcc\x82\xdd\x82\xc2"; $charset = Encode::Detect::Detector::detect($octets); print "$charset\n"; $octets = "\x{805a}\x{5408}\x{6216}\x{8be6}\x{7ec6}"; $charset = Encode::Detect::Detector::detect($octets); print "$charset\n";

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh