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.