|Keep It Simple, Stupid|
Default encoding rules leave me puzzled...by kzwix (Sexton)
|on Jun 20, 2014 at 08:55 UTC||Need Help??|
kzwix has asked for the wisdom of the Perl Monks concerning the following question:
Hello, ô wise ones,
I'm using Perl under an UTF-8 Linux environment (LC_ALL='en_US.UTF-8'), with a perl script which is in an UTF-8-encoded file.
This script states "use utf8;" on one of its first lines, and then, I have some scalar definitions which use accentuated characters (I'm French, so there are some 'é', 'è', 'à', 'ô', 'ù', etc.)
However, when I print strings defined in the script, I see they are garbled (the accentuated characters come out as ugly white squares on the black background of my Putty terminal - Which is ALSO configured to use UTF-8)
Now, if I write :
My question is: Why do I have to specify this encoding ? I thought that Perl adapted to its environment, and the localization environment variables should all be readable, right ?
Can someone explain the reason to me, or point me to relevant documentation ?
Thanks in anticipation.
EDIT: Ok, so, after reading through all these fine answers, I think I understand better my problems, and the solutions:
Please feel free to correct me if you feel that my conclusions are false or misleading.