How to fix the locale settings

i’ve been strugling with my system to get it utf-8’ed . The solution was easy and in a few minutes i’ve repaired the wrong i made previously.

Every now and then, if i tried to emerge a ebuild, some warnings like:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "pt_PT.UTF-8@euro",
LC_ALL = "pt_PT.UTF-8@euro",
LANG = "pt_PT.UTF-8@euro"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

if i did a # locale -a someting like this would show:

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
POSIX
pt_PT
pt_PT.euroutf8
pt_PT@euro
pt_PT@euro.UTF-8

After some googling, i’ve found out that -euro with uft-8 is redudant. So i generated the locale i wanted:
# localedef -c -i pt_PT -f UTF-8 pt_PT.UTF-8

and made sure that ~/.bashrc and /etc/env.d/02locale had the correct locales:
# cat /etc/env.d/02locale
LANG=pt_PT.UTF-8
LC_ALL=pt_PT.UTF-8

# tail -4 ~/.bashrc
export LANG="pt_PT@euro"
export LANGUAGE="pt_PT@euro"
export LC_ALL="pt_PT@euro"

so, to commit the changes do (in gentoo):

# env-update

and

source /etc/profile

And all be roses again. i hope..

just to be really sure that all is working again, i did a # perl -v and no errors showed up!

EDIT: To make sure, try $ locale charmap or for the full listing: $ locale

Advertisements

One thought on “How to fix the locale settings

  1. Thanks you. With your instructions I could solve the perl error messages into the shell of Mandriva distribution.
    Problem Solved

    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s