每次新安装Ubuntu的中文版,一开是Ubuntu的终端Xterm显示的中文都会有很多乱码,甚至有些中文汉字显示不出来,使用起来很不方便,像这样子:
在网上找了很多资料,发现可以通过重新配置Xterm来解决中文乱码问题已经优化Xterm的显示效果。
打开/etc/X11/app-defaults/XTerm,像这样
在最下面添加如下代码:
Xft.dpi:96
xpdf.title: PDF
XTerm*faceSize: 10
XTerm*faceSize1: 10
XTerm*faceSize2: 10
XTerm*faceSize3: 10
XTerm*faceSize4: 10
XTerm*faceSize5: 10
XTerm*faceSize6: 10
XTerm*jumpScroll: true
xterm.termName: xterm-256color
xterm.geometry: 80x36
xterm*scrollBar: false
xterm*rightScrollBar: true
xterm*loginshell: true
xterm*cursorBlink: true
xterm*background: black
xterm*foreground: gray
xterm.borderLess: true
xterm.cursorBlink: true
xterm*colorUL: yellow
xterm*colorBD: white
!fix alt key input
xterm*eightBitInput: false
xterm*altSendsEscape: true
!mouse selecting to copy, ctrl-v to paste
!Ctrl p to print screen content to file
XTerm*VT100.Translations: #override \
Ctrl <KeyPress> V: insert-selection(CLIPBOARD,PRIMARY,CUT_BUFFER0) \n\
<BtnUp>: select-end(CLIPBOARD,PRIMARY,CUT_BUFFER0) \n\
Ctrl <KeyPress> P: print() \n
!font and locale
!xterm*locale: true
!xterm.utf8: true
!xterm*utf8Title: true
xterm*fontMenu*fontdefault*Label: Default
xterm*faceName:DejaVu Sans Mono:antialias=True:pixelsize=16
!xterm*faceName: monofur:antialias=True:pixelsize=20
xter*boldFont: Bitstream Vera Sans Mono:style=Bold:pixelsize=15
xterm*faceNameDoublesize:WenQuanYi Zen Hei:antialias=True:pixelsize=15
xterm*xftAntialias: true
xterm.cjkWidth:true
XTerm*inputMethod: ibus
XTerm*preeditType: Root
PS:如果不是root用户直接通过gedit打开文件的话,普通用户是没有权限修改这个文件的,解决的方法就是在终端Xterm下输入命令:sudo gedit /etc/X11/app-defaults/XTerm,这样打开的XTerm配置文件经过修改当前用户是有权保存并生效的。重启Xterm,效果是不是美观很多呢。