---
title: "ubuntu kylin xterm乱码解决方案"
author: "cuiyadll"
date: "2017-10-06T15:24:00Z"
tags: []
categories: ["操作系统"]
slug: "ubuntu-kylin-xterm"
draft: false
lastmod: "2017-10-06T15:24:00Z"
id: 2395402
url: "https://cuiyadll.iteye.com/blog/2395402"
---

本人比较喜欢Ubuntu这个Linux的发行版，主要是安装程序插件什么的都比较方便，推荐新手使用，可以免去很多麻烦的配置，将注意力放在编程的学习上，当然如果是想专门学Linux的，还是推荐在Centos或者红帽上捣鼓捣鼓，慢慢地对Linux就熟悉了。

每次新安装Ubuntu的中文版，一开是Ubuntu的终端Xterm显示的中文都会有很多乱码，甚至有些中文汉字显示不出来，使用起来很不方便，像这样子：

在网上找了很多资料，发现可以通过重新配置Xterm来解决中文乱码问题已经优化Xterm的显示效果。

打开/etc/X11/app-defaults/XTerm，像这样

 

在最下面添加如下代码：

Xft.dpi:96&nbsp; &nbsp;  
xpdf.title: PDF&nbsp; &nbsp;  
XTerm\*faceSize: 10&nbsp; &nbsp;  
XTerm\*faceSize1: 10&nbsp; &nbsp;  
XTerm\*faceSize2: 10&nbsp; &nbsp;  
XTerm\*faceSize3: 10&nbsp; &nbsp;  
XTerm\*faceSize4: 10&nbsp; &nbsp;  
XTerm\*faceSize5: 10&nbsp; &nbsp;  
XTerm\*faceSize6: 10&nbsp; &nbsp;  
XTerm\*jumpScroll: true&nbsp; &nbsp;  
&nbsp;   
xterm.termName: xterm-256color &nbsp;  
xterm.geometry: 80x36 &nbsp;  
xterm\*scrollBar: false &nbsp;  
xterm\*rightScrollBar: true &nbsp;  
xterm\*loginshell: true &nbsp;  
xterm\*cursorBlink: true &nbsp;  
xterm\*background:&nbsp;&nbsp; black &nbsp;  
xterm\*foreground:&nbsp;&nbsp; gray &nbsp;  
xterm.borderLess: true &nbsp;  
xterm.cursorBlink: true &nbsp;  
xterm\*colorUL: yellow &nbsp;  
xterm\*colorBD: white &nbsp;  
&nbsp; &nbsp;  
!fix alt key input &nbsp;  
xterm\*eightBitInput: false &nbsp;  
xterm\*altSendsEscape: true 

!mouse selecting to copy, ctrl-v to paste &nbsp;  
!Ctrl p to print screen content to file &nbsp;  
XTerm\*VT100.Translations: #override \\ &nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ctrl &lt;KeyPress&gt; V: insert-selection(CLIPBOARD,PRIMARY,CUT\_BUFFER0) \\n\\ &nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;BtnUp&gt;: select-end(CLIPBOARD,PRIMARY,CUT\_BUFFER0) \\n\\ &nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ctrl &lt;KeyPress&gt; P: print() \\n &nbsp;  
&nbsp;   
!font and locale &nbsp;  
!xterm\*locale: true &nbsp;  
!xterm.utf8:&nbsp;&nbsp;&nbsp;&nbsp; true &nbsp;  
!xterm\*utf8Title: true  
xterm\*fontMenu\*fontdefault\*Label: Default &nbsp;  
xterm\*faceName:DejaVu Sans Mono:antialias=True:pixelsize=16 &nbsp;  
!xterm\*faceName: monofur:antialias=True:pixelsize=20 &nbsp;  
xter\*boldFont: Bitstream Vera Sans Mono:style=Bold:pixelsize=15 &nbsp;  
xterm\*faceNameDoublesize:WenQuanYi Zen Hei:antialias=True:pixelsize=15 &nbsp;  
xterm\*xftAntialias: true &nbsp;  
xterm.cjkWidth:true &nbsp;  
XTerm\*inputMethod: ibus   
XTerm\*preeditType: Root &nbsp;

PS：如果不是root用户直接通过gedit打开文件的话，普通用户是没有权限修改这个文件的，解决的方法就是在终端Xterm下输入命令：sudo gedit /etc/X11/app-defaults/XTerm，这样打开的XTerm配置文件经过修改当前用户是有权保存并生效的。重启Xterm，效果是不是美观很多呢。

[Ubuntu下XTerm乱码问题的解决及XTerm的简单配置,布布扣,bubuko.com](http://www.bubuko.com/infodetail_48941.html "Ubuntu下XTerm乱码问题的解决及XTerm的简单配置,bubuko.com")

 

字体下载地址：http://download.csdn.net/download/caoshangpa/9609350

[Ubuntu下XTerm乱码问题的解决及XTerm的简单配置](http://www.bubuko.com/infodetail-48941.html "Ubuntu下XTerm乱码问题的解决及XTerm的简单配置,bubuko.com")