|Pathologically Eclectic Rubbish Lister|
How to sanely handle unicode in perl?by Sec (Monk)
|on Mar 20, 2015 at 16:18 UTC||Need Help??|
Sec has asked for the wisdom of the Perl Monks concerning the following question:
I'm at a loss. Whenever I try to handle unicode/utf8 stuff in perl I hit a wall on how to do it in a sane way.
Please tell me that I'm missing something here.
My goals are:
Text read from stdin, written to stdout and arguments on the commandline should respect the current user locale.
Source code is in a fixed format (usually utf8) Files/pipes should be in the format I specify.
My example script:
Let's run it:
The second case fails horribly. I have no idea why. If I comment the "use open" line, it (of course) fails printing the umlauts on any utf-8 terminal
Is there a way to get perl to "do the right thing"?