in reply to
Re^2: i18n/utf8 problem, 'utf8 "\xF8" does not map to Unicode'
in thread i18n/utf8 problem, 'utf8 "\xF8" does not map to Unicode'
If you have the raw bytestring, the easiest way to see if it's valid UTF-8 is to decode it to a unicode string. If that fails, it wasn't utf8 enough :)
utf8::decode($string)
or die "Input is not valid UTF-8";
or
utf8::decode(my $text = $binary)
or die "Input is not valid UTF-8";
If you leave out the "or die" clause, any invalid UTF-8 will just be seen as ISO-8859-1.
Update: changed the examples as per ikegami's sound response.