0

I am using Emacs 25.1 on x64 Windows 10, I want display Chinese plain text files encoded in BIG5 and GBK encoding as well as UTF, however I found characters in the BIG5 encoding files displayed as gibberish, but GBK and UTF-8 are OK. My current font / encoding setting in .emacs is:

(set-language-environment 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

;; font
(setq font-encoding-alist
 (append '(("gb2312.1980" . chinese-gbk)
       ("iso8859-1$" . iso-8859-1)
       ("iso8859-2$" . iso-8859-2)
       ("iso8859-3$" . iso-8859-3)
       ("iso8859-4$" . iso-8859-4)
       ("iso8859-5$" . iso-8859-5)
       ("iso8859-6$" . iso-8859-6)
       ("iso8859-7$" . iso-8859-7)
       ("iso8859-8$" . iso-8859-8)
       ("iso8859-9$" . iso-8859-9)
       ("iso8859-10$" . iso-8859-10)
       ("iso8859-11$" . iso-8859-11)
       ("iso8859-13$" . iso-8859-13)
       ("iso8859-14$" . iso-8859-14)
       ("iso8859-15$" . iso-8859-15)
       ("iso8859-16$" . iso-8859-16)
       ("ascii-0$" . ascii)
       ("gb2312.1980" . chinese-gb2312)
       ("gbk" . chinese-gbk)
       ("gb18030" unicode)
       ("jisx0208.1978" . japanese-jisx0208-1978)
       ("jisx0208" . japanese-jisx0208)
       ("jisx0201" . jisx0201)
       ("jisx0212" . japanese-jisx0212)
       ("ksx1001" . korean-ksc5601)
       ("ksc5601.1987" . korean-ksc5601)
       ("cns11643.1992.*1" . chinese-cns11643-1)
       ("cns11643.1992.*2" . chinese-cns11643-2)
       ("cns11643.1992.*3" . chinese-cns11643-3)
       ("cns11643.1992.*4" . chinese-cns11643-4)
       ("cns11643.1992.*5" . chinese-cns11643-5)
       ("cns11643.1992.*6" . chinese-cns11643-6)
       ("cns11643.1992.*7" . chinese-cns11643-7)
       ("cns11643.92p1-0" . chinese-cns11643-1)
       ("cns11643.92p2-0" . chinese-cns11643-2)
       ("cns11643.92p3-0" . chinese-cns11643-3)
       ("cns11643.92p4-0" . chinese-cns11643-4)
       ("cns11643.92p5-0" . chinese-cns11643-5)
       ("cns11643.92p6-0" . chinese-cns11643-6)
       ("cns11643.92p7-0" . chinese-cns11643-7)
       ("big5" . big5)
       ("viscii" . viscii)
       ("tis620" . tis620-2533)
       ("microsoft-cp1251" . windows-1251)
       ("koi8-r" . koi8-r)
       ("jisx0213.2000-1" . japanese-jisx0213-1)
       ("jisx0213.2000-2" . japanese-jisx0213-2)
       ("jisx0213.2004-1" . japanese-jisx0213\.2004-1)
       ("iso10646-1$" unicode-bmp)
       ("iso10646.indian-1" unicode-bmp)
       ("unicode-bmp" unicode-bmp)
       ("abobe-symbol" . symbol)
       ("sisheng_cwnn" . chinese-sisheng)
       ("mulearabic-0" . arabic-digit)
       ("mulearabic-1" . arabic-1-column)
       ("mulearabic-2" . arabic-2-column)
       ("muleipa" . ipa)
       ("ethiopic-unicode" unicode-bmp . ethiopic)
       ("is13194-devanagari" . indian-is13194)
       ("Devanagari-CDAC" . devanagari-cdac)
       ("Sanskrit-CDAC" . sanskrit-cdac)
       ("Bengali-CDAC" . bengali-cdac)
       ("Assamese-CDAC" . assamese-cdac)
       ("Punjabi-CDAC" . punjabi-cdac)
       ("Gujarati-CDAC" . gujarati-cdac)
       ("Oriya-CDAC" . oriya-cdac)
       ("Tamil-CDAC" . tamil-cdac)
       ("Telugu-CDAC" . telugu-cdac)
       ("Kannada-CDAC" . kannada-cdac)
       ("Malayalam-CDAC" . malayalam-cdac)
       ("Devanagari-Akruti" . devanagari-akruti)
       ("Bengali-Akruti" . bengali-akruti)
       ("Punjabi-Akruti" . punjabi-akruti)
       ("Gujarati-Akruti" . gujarati-akruti)
       ("Oriya-Akruti" . oriya-akruti)
       ("Tamil-Akruti" . tamil-akruti)
       ("Telugu-Akruti" . telugu-akruti)
       ("Kannada-Akruti" . kannada-akruti)
       ("Malayalam-Akruti" . malayalam-akruti)
       ("muleindian-2" . indian-2-column)
       ("muleindian-1" . indian-1-column)
       ("mulelao-1" . mule-lao)
       ("muletibetan-2" . tibetan)
       ("muletibetan-0" . tibetan)
       ("muletibetan-1" . tibetan-1-column))
     font-encoding-alist)
)
(create-fontset-from-fontset-spec
 (concat
  "-*-consolas-medium-r-normal-*-12-*-*-*-*-*-fontset-consolas,"
  "chinese-gb2312:-*-Microsoft Jhenghei-medium-r-*-*-12-*-*-*-c-*-gb2312*-*,"
  "mule-unicode-0100-24ff:-*-Microsoft Jhenghei-medium-r-*-*-12-*-*-*-c-*-iso10646*-*,"
  "chinese-big5-1:-*-Microsoft Jhenghei-medium-r-*-*-14-*-*-*-*-*-big5-0," 
  "chinese-big5-2:-*-Microsoft Jhenghei-medium-r-*-*-14-*-*-*-*-*-big5-0,"
  "korean-ksc5601:-*-Malgun Gothic-medium-r-*-*-12-*-*-*-*-*-ksc5601*-*,"
  "chinese-cns11643-5:-*-Microsoft Jhenghei-medium-r-*-*-12-*-*-*-c-*-gbk*-*,"
  "chinese-cns11643-6:-*-Microsoft Jhenghei-medium-r-*-*-12-*-*-*-c-*-gbk*-*,"
  "chinese-cns11643-7:-*-Microsoft Jhenghei-medium-r-*-*-12-*-*-*-c-*-gbk*-*,"
  "sjis:-*-Meiryo-medium-r-normal--12-*-jisx0208*-*"
 ))

;; Chinese Font
;  cjk-misc gb18030 chinese-gbk chinese-gb2312
(dolist (charset '(han cjk-misc chinese-gbk))
  (set-fontset-font t ;; (frame-parameter nil 'font)
        charset
        (if (string-equal system-type "windows-nt")
            (font-spec :family "Microsoft Jhenghei")
          (font-spec :family "Noto Sans CJK Regular"))))

(set-default-font "fontset-consolas")
 (set-fontset-font "fontset-consolas"
  'gb18030 '("Microsoft Jhenghei" . "unicode-bmp")) ;; Chinese

So how to display all different Chinese encoding in Emacs 25? Thanks in advance.

2
  • The normal way to do it is to have an empty ~/.emacs. If you still see a problem when using the default config, then try M-x report-emacs-bug. – Stefan Aug 29 '16 at 13:35
  • The default empty .emacs does not solve this problem. – TRX Aug 30 '16 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.