http://qs1969.pair.com?node_id=831664

brycen has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, My gods are in disagreement, who can I trust? The Encode page http://perldoc.perl.org/Encode.html#The-UTF8-flag says:
After $utf8 = decode('foo', $octet); , When $octet is... The UTF8 flag in $utf8 is --------------------------------------------- In ASCII only (or EBCDIC only) OFF In ISO-8859-1 ON In any other Encoding ON ---------------------------------------------
Yet at the altar of Perl 5.10.0 and Perl 5.8:
#use utf8; #use encoding 'iso-8859-1'; #use encoding 'utf-8-strict'; #use encoding::warnings; #check for implicit upgrade use Encode; print '${^UNICODE}='.${^UNICODE}."\n\n"; $a = "face"; $b = "not_a_face=\x{e2}\x{98}\x{ba}"; print "a=",Encode::is_utf8($a)," b=",Encode::is_utf8($b),"\n\n"; $a=Encode::decode('iso-8859-1',$a); $b=Encode::decode('iso-8859-1',$b); print "a=",Encode::is_utf8($a)," b=",Encode::is_utf8($b),"\n\n";
Produces:
${^UNICODE}=63 a= b= a=1 b=1
Showing that a pure ASCII string has the utf8 flag set. My faith in Perl Unicode is tested. Monks can you help me see the light?

Bryce Nesbitt, Berkeley Electronic Press, Berkeley CA