Thursday, April 18, 2013

"perl: warning: Setting locale failed." : Solved : How To?

Bookmark and Share

I have started receiving perl locale warnings despite LC_CTYPE was set to "en_IN" . Don't know what triggered it on my machine!
Every perl script call was emitting these locale warnings.

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Well I know there are different ways to solve this problem based on different distribution to make it work. But frankly the easiest and classic way is to add below entries into /etc/profile

export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8   


Another way could be ,
echo “LC_ALL=en_US.UTF-8 ” >> /etc/default/locale

If wondering which locale to add then below CLI will list all supported locale on linux box,

$ locale -a
C
C.UTF-8
de_CH.utf8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
POSIX
zh_CN.utf8
zh_SG.utf8


Will it cause any repercussions? I don't know. But aleast on my machine this solved the problem and stopped giving "perl: warning: Setting locale failed." warning messages and till now everything seems to be going fine.


No comments:

Post a Comment

Your valuable comments are welcome. (Comments will be moderated.)

 




Technology