在 OS X Lion 中,LANG 未设置为 UTF-8,如何解决? [英] In OS X Lion, LANG is not set to UTF-8, how to fix it?

查看:20
本文介绍了在 OS X Lion 中,LANG 未设置为 UTF-8,如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 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 Lion 设置,使用西班牙语.我什么都没动.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆