Gentoo Forums
Gentoo Forums
Quick Search: in
Perl: Setting locale failed [SOLVED]
View unanswered posts
View posts from last 24 hours

rackathon
 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
iandoug
Tux's lil' helper
Tux's lil' helper


Joined: 11 Feb 2005
Posts: 126
Location: Cape Town, South Africa

PostPosted: Tue Jun 24, 2008 3:58 am    Post subject: Perl: Setting locale failed [SOLVED] Reply with quote

Hi

This seems to be a common issue with Perl.

I've been using it for years on this box, but after recent updates/and/or/cpan package installations, now get locale errors.

Following advice on the forums, I've *half* fixed it.... when running as root, no problem, only when running as user.

As root:
Code:

gentoo ~ # perl -v

This is perl, v5.8.8 built for x86_64-linux

Copyright 1987-2006, Larry Wall
(etc)


As user:
Code:

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

This is perl, v5.8.8 built for x86_64-linux

Copyright 1987-2006, Larry Wall
(etc)


Contents of /etc/locale.gen
Code:

gentoo ~ # cat /etc/locale.gen
# /etc/locale.gen: list all of the locales you want to have on your system
#
# The format of each line:
# <locale> <charmap>
#
# Where <locale> is a locale located in /usr/share/i18n/locales/ and
# where <charmap> is a charmap located in /usr/share/i18n/charmaps/.
#
# All blank lines and lines starting with # are ignored.
#
# For the default list of supported combinations, see the file:
# /usr/share/i18n/SUPPORTED
#
# Whenever glibc is emerged, the locales listed here will be automatically
# rebuilt for you.  After updating this file, you can simply run `locale-gen`
# yourself instead of re-emerging glibc.

#en_US ISO-8859-1
#en_US.UTF-8 UTF-8
#ja_JP.EUC-JP EUC-JP
#ja_JP.UTF-8 UTF-8
#ja_JP EUC-JP
#en_HK ISO-8859-1
#en_PH ISO-8859-1
#de_DE ISO-8859-1
#de_DE@euro ISO-8859-15
#es_MX ISO-8859-1
#fa_IR UTF-8
#fr_FR ISO-8859-1
#fr_FR@euro ISO-8859-15
#it_IT ISO-8859-1

en_ZA.UTF-8 UTF-8
#en_ZA ISO-8859-1
en_GB.UTF-8 UTF-8
#en_GB ISO-8859-1
en_US.UTF-8 UTF-8
#en_US ISO-8859-1
af_ZA.UTF-8 UTF-8
#af_ZA ISO-8859-1


(aside: the commented out locales at the bottom cause problems in OpenOffice printing)

locale as root:
Code:

gentoo ~ # locale
LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=en_GB.UTF-8


locale as user:
Code:

~ $ locale
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_ALL to default locale: No such file or directory
LANG=en_ZA
LC_CTYPE="en_ZA"
LC_NUMERIC="en_ZA"
LC_TIME="en_ZA"
LC_COLLATE="en_ZA"
LC_MONETARY="en_ZA"
LC_MESSAGES="en_ZA"
LC_PAPER="en_ZA"
LC_NAME="en_ZA"
LC_ADDRESS="en_ZA"
LC_TELEPHONE="en_ZA"
LC_MEASUREMENT="en_ZA"
LC_IDENTIFICATION="en_ZA"
LC_ALL=en_ZA



Contents of user's .bashrc
Code:

~ $ cat .bashrc
# /etc/skel/.bashrc:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/skel/.bashrc,v 1.8 2003/02/28 15:45:35 azarah Exp $

# This file is sourced by all *interactive* bash shells on startup.  This
# file *should generate no output* or it will break the scp and rcp commands.

# colors for ls, etc.
eval `dircolors -b /etc/DIR_COLORS`
alias d="ls --color"
alias ls="ls --color=auto"
alias ll="ls --color -l"
alias lt="ls --color -l -rt"

# Change the window title of X terminals
case $TERM in
        xterm*|rxvt|Eterm|eterm)
                PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
                ;;
        screen)
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
                ;;
esac

# put current working dir in prompt
export PS1="\\w \$ "

##uncomment the following to activate bash-completion:
#[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion
#export LANG="en_ZA"
#export LC_ALL="en_ZA"


Will appreciate any pointers as to why the user is getting a different setup to root. .... think root also used to be en_ZA but I tried setting things to
en_GB in the hope of fixing the problem, not sure exactly where/how I managed to achieve this state.... :-)

Would ideally like to run as en_ZA since that's where I am...

Thanks, Ian
_________________
Asus A8N-SLI, AMD64 3200+, MSI RX600, 2GB RAM | Asus M3A78 64 X2 6000+, PX9800 GT, 4GB Ram


Last edited by iandoug on Tue Jun 24, 2008 7:01 am; edited 1 time in total
Back to top
View user's profile Send private message
TheAl
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jan 2004
Posts: 134

PostPosted: Tue Jun 24, 2008 6:51 am    Post subject: Re: Perl: Setting locale failed Reply with quote

iandoug wrote:

locale as user:
Code:

~ $ locale
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_ALL to default locale: No such file or directory
LANG=en_ZA
LC_CTYPE="en_ZA"
LC_NUMERIC="en_ZA"
LC_TIME="en_ZA"
LC_COLLATE="en_ZA"
LC_MONETARY="en_ZA"
LC_MESSAGES="en_ZA"
LC_PAPER="en_ZA"
LC_NAME="en_ZA"
LC_ADDRESS="en_ZA"
LC_TELEPHONE="en_ZA"
LC_MEASUREMENT="en_ZA"
LC_IDENTIFICATION="en_ZA"
LC_ALL=en_ZA




Problem should be arround here.
As root, do a
Code:
locale-gen
Back to top
View user's profile Send private message
iandoug
Tux's lil' helper
Tux's lil' helper


Joined: 11 Feb 2005
Posts: 126
Location: Cape Town, South Africa

PostPosted: Tue Jun 24, 2008 7:00 am    Post subject: Re: Perl: Setting locale failed [SOLVED] Reply with quote

TheAl wrote:

Problem should be arround here.
As root, do a
Code:
locale-gen


Thanks, that fixed it. Must have been running locale-gen as user instead of root.

Note: I had to log out of KDE and out of gentoo, before the change 'took'.

Thanks for your help :-)

cheers, Ian
_________________
Asus A8N-SLI, AMD64 3200+, MSI RX600, 2GB RAM | Asus M3A78 64 X2 6000+, PX9800 GT, 4GB Ram
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum