每次新安裝Ubuntu的中文版,一開是Ubuntu的終端Xterm顯示的中文都會(huì)有很多亂碼,甚至有些中文漢字顯示不出來,使用起來很不方便,像這樣子:
在網(wǎng)上找了很多資料,發(fā)現(xiàn)可以通過重新配置Xterm來解決中文亂碼問題已經(jīng)優(yōu)化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打開文件的話,普通用戶是沒有權(quán)限修改這個(gè)文件的,解決的方法就是在終端Xterm下輸入命令:sudo gedit /etc/X11/app-defaults/XTerm,這樣打開的XTerm配置文件經(jīng)過修改當(dāng)前用戶是有權(quán)保存并生效的。重啟Xterm,效果是不是美觀很多呢。