解决Ubuntu cannot change locale (en_US.UTF-8)技术
新买的6刀 VPS 上,每次登录都出现如下警告,编辑文件的中文出现乱码,使用 screen -U 设置编码为 UTF-8 ,依然出现如下警告。
Welcome to Ubuntu 13.10 (GNU/Linux 2.6.32-042stab094.7 x86_64) * Documentation: https://help.ubuntu.com/ Last login: Fri Mar 27 07:19:43 2015 from 101.231.33.158 -bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
root@may:/var/www/WebChat# locale locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory LANG=en_US.UTF-8 LANGUAGE= 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=en_US.UTF-8
使用 local-gen 安装 en_US 的 locale,解决问题,如下。
root@may:/var/www/WebChat# locale -a locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_COLLATE to default locale: No such file or directory C C.UTF-8 POSIX root@may:/var/www/WebChat# locale-gen en_US.UTF-8 /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) Generating locales... en_US.UTF-8... done Generation complete. root@may:/var/www/WebChat# locale LANG=en_US.UTF-8 LANGUAGE= 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=en_US.UTF-8
# vim /etc/locale.gen // 打开需要的字符集# locale-genGenerating locales (this might take a while)... zh_CN.UTF-8... doneGeneration complete.
相关文章
暂无