Postgres语言环境错误

ard*_*igh 14 unix postgresql ubuntu locale

我在Ubuntu上的Digital River上托管了一个Postgres数据库,并按照这些说明安装:

但是区域设置有问题,我无法解决如何修复它.当我运行psql命令时,我收到以下错误:

postgres@assay:/home/deployer$ psql
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
psql (9.1.9)
Run Code Online (Sandbox Code Playgroud)

ard*_*igh 28

非常感谢数字河论坛上的Kamal Nasser提供正确的答案(以下命令需要root权限):

$ locale-gen en_US en_US.UTF-8 
$ dpkg-reconfigure locales
Run Code Online (Sandbox Code Playgroud)

我认为这是原始答案的正确链接:数字海洋网站没有响应,所以我无法检查它. https://www.digitalocean.com/community/questions/postgresql-and-rails-4


ask*_*how 9

在尝试了ardochhigh的回答之后:

$ sudo locale-gen en_US en_US.UTF-8 
$ sudo dpkg-reconfigure locales
Run Code Online (Sandbox Code Playgroud)

问题依然存在

之后我看到了这个解决了我的问题的答案:

https://www.digitalocean.com/community/questions/language-problem-on-ubuntu-14-04

显然没有设置LAGUAGE shell变量:

$ sudo bash

$ export LANGUAGE="en_US.UTF-8"
$ echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
$ echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale

$ # next: logout and login
Run Code Online (Sandbox Code Playgroud)

  • 请注意:如果您是通过ssh登录的,则问题可能出在您的系统终端中.将这两行添加到`.bashrc`或`.profile`文件将为我和我的伙伴@forons提供技巧:`export LC_CTYPE = en_US.UTF-8``export LC_ALL = en_US.UTF-8` (5认同)