e)建议command-line模式和X11模式用下面的编码方案
| cat ~/.bashrc <<EOF export LANG="C" export LC_ALL="C" EOF |
| cat ~/.xinitrc <<EOF export LANG="en_US.utf8" export LC_ALL="en_US.utf8" EOF |
好了,下面来解决一些实际问题:
2.1 SAMBA共享编码问题
方法一:
在编译内核时选择
| File systems-->Network file systems--> SMB file system support --> Use a default NLS (cp936) Default Remote NLS Option |
| smbmount //windows_share/c$ /mnt/tmp |
方法二:挂载时指定编码
| smbmount -o codepage=cp936,iocharset=utf8 \ //windows_share/c$ /mnt/tmp |
ipcharset指定samba服务器的字符编码,这个通常也就是你用的Linux字符集编码
为了免于每次mount时的输入麻烦,将其写入到/etc/samba/smb.conf的[global]字段中
| dos charset = cp936 unix charset = utf8 |
2.2 挂载Win分区和U盘文件编码问题
方法一:
| File systems-->DOS/FAT/NTFS File systems --> VFAT fs support --> (936) Default codepage for FAT (utf8) Default iocharset for FAT |
方法二:
如果内核编译没有设置VFAT的默认字符集编码,mount时就指定吧:
| mount -t fs-type -o iocharset=cp936 /dev/hd? /mnt/tmp |
2.3 rxvt-unicode中文显示问题
在~/.Xdefaults中加入下面的字体设置,rxvt-unicode能比较好地显示中文
| URxvt.font:xft:Luxi Mono:pixelsize=16, \ xft:SimSun:pixelsize=16:antialias=true |
2.4 Gvim文件乱码问题
| cat ~/.gvimrc <<EOF set encoding=utf-8 set fileencodings=utf-8,euc-cn,euc-tw,lanti1 set guifont=SimSun\ 13 EOF |
guifont指定一个显示中文的字体
fileencodings指定gvim打开文件时依次尝试选择utf8,eun-cn,...等编码打开文件,如果仍然不能正确显示中文,直接试试命令,99%的文本文件都能正确显示
| :set enc=euc-cn :set enc=cp936 |
<*> Traditional Chinese charset (Big5)
