in reply to Behaviour of Encode::decode_utf8 on ASCII

I just ran into this (still existing) bug rt://34259. I'm using Encode v2.39. In my testing, it appears that whenever decode() is called, the UTF8 flag always gets set, no matter what characters are in the string, and no matter which character set is specified -- even when specifying 'ascii' as the character set:
use Encode; my $t = "abc"; my $d = decode('ascii',$t); printf "is_utf8=%d\n", (utf8::is_utf8($d) ? 1 : 0);
output:
is_utf8=1
I did find a workaround: it appears that utf8::decode($string) does NOT set the UTF8 flag if $string only contains ASCII characters.