Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by moritz (Cardinal)
on Oct 01, 2010 at 15:14 UTC ( [id://862975]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://862975]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-29 13:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found