Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: How to sanely handle unicode in perl?

by Your Mother (Archbishop)
on Mar 20, 2015 at 16:39 UTC ( #1120764=note: print w/replies, xml ) Need Help??

in reply to How to sanely handle unicode in perl?

There is a very deep discussion here—tchrist on UTF-8 and Unicode issues in Perl—which includes many good recommendations and suggested defaults between the exhaustive details including a suggestion similar to choroba’s–

use open qw( :encoding(UTF-8) :std );

Replies are listed 'Best First'.
Re^2: How to sanely handle unicode in perl?
by Sec (Monk) on Mar 20, 2015 at 16:46 UTC
    This does also not solve my problem. I want perl to respect the locale of the user calling that script.

    If I use your "open" statement and run the script in an iso8859-1 terminal, i get the following:

    karoshi:~>LC_CTYPE=de_DE.ISO-8859-1 ./ I read a line, that is 1 chars long. That line is: ö That line in ascii is: o
    which is clearly incorrect.

      See point 14 in Assume Brokeness of the link I gave — “Code that assumes Unicode gives a fig about POSIX locales is broken.”

        I do not assume unicode. I just want to handle data correctly. perl is apparently unable to output data in the way it's environment requires it to.

        The frustrating part is that perl looks like it is equipped to work. It is _able_ to do output conversion on the fly. It is just not able to do it correctly without user intervention.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2022-01-16 20:23 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (49 votes). Check out past polls.