ubuntu文本模式/終端中文亂碼解決


ubuntu文本模式/終端中文亂碼解決 (轉)
http://www.ubuntukylin.com/ukylin/forum.php?mod=viewthread&tid=5818
(出處: Ubuntu Kylin技術論壇)

最近在學習linux文本模式下的使用,遇到第一個問題就是在文本模式下中文亂碼,自然想到是編碼的問題,所以在網上找了一下解決方法,有人的解決方式是以下這樣的(發現我的ubuntu13.10無效,可能我還不是很瞭解吧):

--------------------------------
1.Alt+Ctrl+F1 進入第一個終端tty1,發現中文亂碼。 
2.安裝zhcon。 
sudo apt-get install zhcon
3 輸入下面命令,啓動zhcon,中文顯示正常。 
sudo zhcon --utf8 --drv=vga

---------------------------------


既然以上方法解決不了我遇到的問題,那當然就要尋找可以解決的辦法,然後我瞭解到了fbterm這個東西(有效):



fbterm--支持中文顯示的控制檯(順便科普一下)
-----------------------------------------------------------------------
       fbterm 提供了一個快速的終端仿真器,它直接運行在你的系統中的幀緩衝 (framebuffer) 之上。使用幀緩衝可以在終端渲染 UTF-8 文本時可以提高性能。fbterm 旨在提供國際化和現代字體支持時至少與 Linux 內核終端一樣快。它允許你在同一個幀緩衝上創建多達 10 個不同的終端窗口,每個窗口都有它的回滾歷史。

       要運行 fbterm,首先檢查當前用戶是否在 video 組,如不在,則加入。當運行 fbterm 後,會在用戶主目錄下生成 .fbtermrc 配置文件,其中可以更換字體樣式及大小、默認前/背景色。


      若你不能看到中文,按 Ctrl+Alt+E 退出後,再運行下面的命令:
       LANG=zh_CN.utf-8 fbterm

-----------------------------------------------------------------------
1.下面我就安裝了fbterm:
sudo apt-get install fbterm


2.安裝完後,運行fbterm:
sudo fbterm


3.退出fbterm
在控制檯中按 Ctrl+Alt + E 退出



4.當然fbterm功能是很強大的,支持字體樣式、大小、樣色設置等,修改配置文件.fbtermrc即可,在控制檯輸入以下命令:
sudo gedit ~/.fbtermrc


打開配置文件內容大致如下,可以根據需要做相應修改保存(然後重新啓動fbterm:在控制檯輸入Ctrl+Alt+E 退出)則可:
---------------------------------


# Configuration for FbTerm


# Lines starting with '#' are ignored.
# Note that end-of-line comments are NOT supported, comments must be on a line of their own.




# font family names/pixelsize used by fbterm, multiple font family names must be seperated by ','
# and using a fixed width font as the first is strongly recommended
#font-names=Nokia Font YanTi
font-names=Monaco
font-size=15


# force font width (and/or height), usually for non-fixed width fonts
# legal value format: n (fw_new = n), +n (fw_new = fw_old + n), -n (fw_new = fw_old - n)
#font-width=
#font-height=


# default color of foreground/background text
# available colors: 0 = black, 1 = red, 2 = green, 3 = brown, 4 = blue, 5 = magenta, 6 = cyan, 7 = white
color-foreground=7
color-background=0


# max scroll-back history lines of every window, value must be [0 - 65535], 0 means disable it
history-lines=1000


# up to 5 additional text encodings, multiple encodings must be seperated by ','
# run 'iconv --list' to get available encodings.
text-encodings=


# cursor shape: 0 = underline, 1 = block
# cursor flash interval in milliseconds, 0 means disable flashing
cursor-shape=0
cursor-interval=500


# additional ascii chars considered as part of a word while auto-selecting text, except ' ', 0-9, a-z, A-Z
word-chars=._-


# change the clockwise orientation angle of screen display
# available values: 0 = 0 degree, 1 = 90 degrees, 2 = 180 degrees, 3 = 270 degrees
screen-rotate=0


# specify the favorite input method program to run
input-method=yong


# treat ambiguous width characters as wide
#ambiguous-wide=yes
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章