You are not logged in.

#1 2016-09-27 08:35:55

spegesilden
Member
From: Denmark
Registered: 2010-12-22
Posts: 17

[SOLVED] Setting locale properly

I was trying to use googler for searching google. What happened was

$ googler recursion

1 Recursion - Wikipedia, the free encyclopedia
https://en.wikipedia.org/wiki/Recursion
[ERROR] 'ascii' codec can't encode character '\xa0' in position 165: ordinal not in range(128)

So I googled the old way and found this thread https://github.com/jarun/googler/issues/131.
According to this my the output of running locale should look like

$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_IN.UTF-8
LC_TIME=en_IN.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_IN.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_IN.UTF-8
LC_NAME=en_IN.UTF-8
LC_ADDRESS=en_IN.UTF-8
LC_TELEPHONE=en_IN.UTF-8
LC_MEASUREMENT=en_IN.UTF-8
LC_IDENTIFICATION=en_IN.UTF-8
LC_ALL=

But when I run locale, I get

$ locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

I have uncommented the line #en_US.UTF-8 UTF-8 in /etc/locale.gen, and I have run

# locale-gen

and afterwards set /etc/locale.conf to be

$ cat /etc/locale.conf
LANG=en_US.UTF-8

If I on the other hand log into my root user and run locale, I get

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

and googler seems to work, on my root user.

I guess I have overlooked something or I am just being plain stupid, but I can't really figure out why the locale isn't set properly on my user.

SOLUTION: The problem seemed to be that I'm using fish. I simply inserted the line

set -x LC_ALL en_US.UTF-8

into my ~/.config/fish/config.fish

Last edited by spegesilden (2016-09-29 07:39:57)

Offline

#2 2016-09-27 08:55:18

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: [SOLVED] Setting locale properly

Are you using fish?


pkgshackscfgblag

Offline

#3 2016-09-27 15:49:46

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [SOLVED] Setting locale properly

Maybe locale for your user is overridden ?

Look for ~/.config/locale.conf or   $XDG_CONFIG_HOME/locale.conf .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#4 2016-09-27 16:09:56

ooo
Member
Registered: 2013-04-10
Posts: 1,637

Re: [SOLVED] Setting locale properly

If you're using an desktop environment, it could be overriding your global locale settings. If so, check your desktop's localization settings.

Offline

#5 2016-09-29 07:36:34

spegesilden
Member
From: Denmark
Registered: 2010-12-22
Posts: 17

Re: [SOLVED] Setting locale properly

ayekat wrote:

Are you using fish?

Yes I am using fish. That seems to do the trick. Thanks a lot.

Offline

Board footer

Powered by FluxBB