Page 1 of 1

Problem with locale

Posted: Fri Jul 20, 2012 10:00 am
by discopimp
hello,

just got my pi today and installed Debian Wheezy on it ... everything seems to run fine except i am getting the following errors all the time:

Code: Select all

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
I have tried to set the locale via:

Code: Select all

export LC_ALL=en_GB
export LANGUAGE=en_GB
or putting this directly into /etc/environment

Code: Select all

LANGUAGE = en_GB
LC_ALL = en_GB
LANG = en_GB
LC_TYPE = en_GB
or trying:

Code: Select all

apt-get install locales-all
or

Code: Select all

dpkg-reconfigure locales
nothing seems to work, i still get the error/warning everytime i install sth via apt-get

what am i missing ?

Re: Problem with locale

Posted: Sat Jul 28, 2012 12:05 pm
by roppert
You should be able to fix it with Raspi-config. To start it just run:

Code: Select all

sudo raspi-config
Select change_locale and then make sure the locale you want to use is selected in the list. If not then select it and select OK and it will be built for you.

Re: Problem with locale

Posted: Sat Jul 28, 2012 7:57 pm
by bredman
Does this problem happen if you are using a particular program on the RPi, or is it when you use SSH from another computer?

If it happens when using SSH, this is a fault on the SSH client, not the RPi. For example using an Ubuntu machine as the SSH client will cause this problem.

To fix this SSH problem, edit the file /etc/ssh/ssh_config on the SSH client (not the RPi) and remove the line
SendEnv LANG LC_*

This stops the client sending invalid locale information to the RPi.

Re: Problem with locale

Posted: Wed Feb 27, 2013 9:37 pm
by MacValley
Thanks bredman, your tip worked for me.
In my case, however, the conf file is /etc/ssh_config (ssh client on Mac Mountain Lion, 10.8.2). I commented like this:
# SendEnv LANG LC_*
and now I can even run python scripts on the raspberry that earlier caused errors like
"UnicodeEncodeError: 'ascii' codec can't encode character ..."
Great!

Re: Problem with locale

Posted: Thu Apr 11, 2013 9:26 am
by rez
Bredman thank you so much!!

This has been annoying me for a while.... it didn't break anything but every time it cropped up I ended up messing with the locale settings on my pi and not getting anywhere and giving up.

Never thought it could be the client side.... hashed out that from my ssh_config on the client and all is well again....... THANK YOU!!!

Re: Problem with locale

Posted: Thu Aug 29, 2013 12:27 pm
by wickedsight
Thanks a lot, tried so many things to fix this already.

Also, for newbs like me, after changing this don't forget to restart the ssh connection.

Re: Problem with locale

Posted: Fri Jan 15, 2016 2:04 pm
by femindharamshi10
Even i am having problems with this... deluge-web doesnt work because of this problem... when i try to change locale to en_US UTF-8 it again gives me error Cannot set LC_CTYPE etc... and again i am back to the same prolem

Re: Problem with locale

Posted: Tue Dec 12, 2017 3:55 pm
by srgrn
Hi,
I had the same issue even after running raspi-config and rebooting the pi.
However what worked for me was telling the pi to stop recieve the environment variable

I edited the /etc/ssh/sshd_config
and commented out the line
AcceptEnv LANG LC_*


this prevents the pi from accepting the variables sent by my computer forcing it to use its own

Hope it helps

Re: Problem with locale

Posted: Thu May 30, 2019 5:51 am
by moonkrj
Hi,

I didn't try that. But thanks. I had the same issue after rebooting the pi. But I found the solution on Daker.me blog. The possible way out is to set the locale to en_US.UTF-8
It helped.
Downloaded solution from write my essay

Re: Problem with locale

Posted: Tue Jul 02, 2019 6:11 am
by mlazarov
discopimp wrote:
Fri Jul 20, 2012 10:00 am
putting this directly into /etc/environment

Code: Select all

LANGUAGE = en_GB
LC_ALL = en_GB
LANG = en_GB
LC_TYPE = en_GB
There should be no spaces around the equal signs

So put this in your /etc/environment file:

Code: Select all

LANGUAGE=en_GB
LC_ALL=en_GB
LANG=en_GB
LC_TYPE=en_GB