The utf8 pragma and utf8 encodings on file descriptors confuse me. For example, this clearly simple code ...
use utf8; print qq[fü];
To be clear, the hexadecimal dump on "fü" is 66 c3 bc , which, if I'm not mistaken, is the correct UTF8.
This prints 66 fc , which is not UTF8, but Unicode or possibly Latin-1. Turn off use utf8 and I will get 66 c3 bc . This is the opposite of what I expect.
Now add pramgas filehandle to the file.
use utf8; binmode *STDOUT, ':encoding(utf8)'; print qq[fü];
Now I get 66 c3 bc . But remove use utf8 and I get 66 c3 83 c2 bc , which makes no sense to me.
What is the right thing to do my DWIM code with UTF8?
PS My locale is set to "en_US.UTF-8" and Perl 5.10.1.
perl utf-8
Schwern
source share