But it doesn't DWIM (just give me the ü!!!)
Then just print it directly, without the Data::Dumper step.
Data::Dumper is supposed to return perl code that evaluates to the original. If Data::Dumper emitted ü, it would only work if use utf8 was in scope.
Term::ReadLine(::Gnu) I still haven't figured out why the utf8::decode($str) is neccessary here. I thought I told perl that all input and output was to be in utf8 with the use open... line.
Term::ReadLine reads from the terminal, not from any of the standard streams. And you never told Perl about the terminal.... It's probably also the difference between plain read/readline and sysread (which doesn't use any IO layers at all).
Am I doing something fundamentally wrong?
No. It's just that Perl 5 doesn't properly expose the difference between binary data and text to the user, so that debugging Encoding mess is always a hassle.
FWIW I found Devel::Peek useful for debugging non-ASCII strings
In reply to Re: Why am I having so much trouble and pain with UTF-8 in perl?
by moritz
in thread Why am I having so much trouble and pain with UTF-8 in perl?
by Lightknight
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |