免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1112 | 回复: 0
打印 上一主题 下一主题

Linux乱码问题,字符编码问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-06-10 13:58 |只看该作者 |倒序浏览
一,命令行出现乱码
先查看语言
[root@localhost Desktop]# env|grep LANG
LANG=zh_CN.UTF-8


不管三七二十一,运行这命令
unset LANG
就ok了,此命令式去掉语言,也就是不要语言,结果就是默认英文了,要设置为中文提示
用export LANG=zh_CN.gb18030

看实例:

[root@localhost ~]# pwd
/root
[root@localhost ~]# ls
anaconda-ks.cfg  Desktop  install.log  install.log.syslog  scsrun.log
[root@localhost ~]# cd D
-bash: cd: D: 娌℃湁閭d釜鏂囦欢鎴栫洰褰?
                                          [root@localhost ~]# cd Desktop
[root@localhost Desktop]# lang
-bash: lang: command not found
[root@localhost Desktop]# LANG
-bash: LANG: command not found
[root@localhost Desktop]# env|grep LANG
LANG=zh_CN.UTF-8
[root@localhost Desktop]# unset LANG
[root@localhost Desktop]# cd d
-bash: cd: d: No such file or directory
[root@localhost Desktop]# set LANG=zh_CN.gb18030
[root@localhost Desktop]# cd d
-bash: cd: d: No such file or directory
[root@localhost Desktop]# unset LANG
[root@localhost Desktop]# env|grep LANG
[root@localhost Desktop]# set LANG=zh_CN.gb18030
[root@localhost Desktop]# env|grep LANG
[root@localhost Desktop]# export LANG=zh_CN.gb18030
[root@localhost Desktop]# env|grep LANG
LANG=zh_CN.gb18030
[root@localhost Desktop]# cd d
-bash: cd: d: 没有那个文件或目录
[root@localhost Desktop]#


set是设局部变量
export是设置全局变量

还有两条命令没去研究
env LANG="XXX"
env GDM_LANG="XXX"



二,别的软件乱码

我把从LINUX中DUMP出的数据(数据库是10.1.0)IMP到windows的oracle数据库中(数据库是10.2.0),有些汉字变成问号,比如,存储过程中的汉字注释,有应用程序查询出数据结果,有的汉字也显示为‘’???,说明:这两个数据库字符集都是zhs16gbk,客户端也是zhs16gbk,所以,就不知道原因在哪儿了,求高手,在线等
有人说用set NLS_LANG=american_america.ZHS16GBK


注册 表里面有两个地方 /oracle/nls_lang ;/oracle/homeo/nls_lang ...
我的经验是主要改homeo里面的那个。

是你export出来的数据有问题,把linux下oracle的字符集改为和window一致后,再exp之后imp就没有问题了
可以通过 select * from nls_database_parameters;
查看nls_characters是什么类型的
之后update props$ set valuse$='zh..'wheren name='nls_characters'
后就ok了

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/98413/showart_1960864.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP