在OS X Lion中,LANG未设置为UTF-8,如何解决? [英] In OS X Lion, LANG is not set to UTF-8, how to fix it?
问题描述
我尝试在OS X Lion中设置postgress,并发现没有正确设置LOCALE环境变量。
I try to setup postgress in OS X Lion, and find that is not correctly setup the LOCALE environment var.
这是什么设置:
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
我期待UTF-8的东西。这是一个干净的OS X狮子设置,配有西班牙语。我不会移动任何东西。
I expect something with UTF-8. This is a clean OS X Lion setup, with spanish language. I don't move anything.
我不知道如何设置为UTF-8。
I don't know how setup it to UTF-8.
在终端设置中,检查UTF-8并将LOCALE设置为打开,尽管不起作用。
In the terminal settings, is check UTF-8 and set LOCALE in open, despite that don't work.
推荐答案
我注意到当从OSX Lion机器登录运行Red Hat的服务器时,完全相同的问题。
I noticed the exact same issue when logging onto servers running Red Hat from an OSX Lion machine.
尝试添加或编辑〜/ .profile
文件,以正确导出您的区域设置,会话。
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
添加到文件中的这两行应足以设置语言环境[replace en_US
为您所需的区域设置,并事先检查它确实安装在系统上( locale -a
)]。
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
)].
之后,您可以开始一个新的会话,并使用 locale
进行检查:
After that, you can start a new session and check using locale
:
$ 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"
这篇关于在OS X Lion中,LANG未设置为UTF-8,如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!