I try to setup postgress in OS X Lion, and find that is not correctly setup the LOCALE environment var.
This is what is set:
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
I expect something with UTF-8. This is a clean OS X Lion setup, with spanish language. I don't move anything.
I don't know how setup it to UTF-8.
In the terminal settings, is check UTF-8 and set LOCALE in open, despite that don't work.
zsh --no-rcs
and zsh --no-rcs --no-global-rcs
to narrow down the problem. Also, try just running the locale
command without a shell via New Command and see what it reports.
set locale environment variables
off, restart the terminal and then switch it back on to get the right environment to show up.
I noticed the exact same issue when logging onto servers running Red Hat from an OSX Lion machine.
Try adding or editing the ~/.profile
file for it to correctly export your locale settings upon initiating a new session.
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
These two lines added to the file should suffice to set the locale [replace en_US
for your desired locale, and check beforehand that it is indeed installed on your system (locale -a
)].
After that, you can start a new session and check using locale
:
$ locale
The following should be the output:
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
I recently had the same issue on OS X Sierra with bash shell, and thanks to answers above I only had to edit the file
~/.bash_profile
and append those lines
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
bash_profile
and I have create it manually. And without put export
to bash_profile
, every time we reset terminal the language will rollback.
This is a headbreaker for a long time. I see now it's OSX.. i change it system-wide and it works perfect
When i add this the LANG in Centos6 and Fedora is also my preferred LANG. You can also "uncheck" export or set locale in terminal settings (OSX) /etc/profile
export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8
if you have zsh installed you can also update ~/.zprofile
with
if [[ -z "$LC_ALL" ]]; then
export LC_ALL='en_US.UTF-8'
fi
and check the output using the locale
cmd as show above
❯ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
I had this issue with MacOS High Sierria.
https://i.stack.imgur.com/qaOhb.png
You can set up locale as well as language to UTF-8 format using below command :
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
https://i.stack.imgur.com/OqTq8.png
Now in order to check whether locale environment is updated use below command :
Locale
https://i.stack.imgur.com/Pjtar.png
if [[ -z "$LC_ALL" ]]; then
export LC_ALL='en_US.UTF-8'
fi
then check for locale, output should be :
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
Success story sharing
.bash_profile
on my home folder and.profile
was not being sourced when.bash_profile
was present. I needed to manually source.profile
inside.bash_profile
~/.zshrc
... well now works like a charmLANG
andLC_ALL
. OnlyLANG
should be set. First, they both do the same - set default values for all locale variables (e.g.LC_TIME
,LANGUAGE
) - withLC_ALL
having precedence overLANG
.LANG
is the one meant to be used in standard configuration, whileLC_ALL
is only for debugging purposes (as it overwrites everything else). Some reference