in reply to Why am I having so much trouble and pain with UTF-8 in perl?

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

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: Why am I having so much trouble and pain with UTF-8 in perl?
by Lightknight (Beadle) on Jun 25, 2015 at 10:19 UTC