Unicode characters in emacs term-mode

大城市里の小女人 提交于 2019-11-30 03:58:48

The following worked for me:

(add-hook 'term-exec-hook
          (function
           (lambda ()
             (set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))))

ansi-term seems to ignore the default-process-coding-system variable, so I had to set it buffer-locally after it executes my shell.

After getting a better understanding of term.el, the following works:

(defadvice ansi-term (after advise-ansi-term-coding-system)
    (set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))
(ad-activate 'ansi-term)

Trying this with term-mode-hook is broken because in term.el, term-mode-hook is called before switching to the terminal buffer, so set-buffer-process-coding-system breaks due to the lack of a process associated with the buffer.

Michael Markert

Try

(set-terminal-coding-system 'utf-8-unix)

That's C-x RET t not C-x RET p.


So C-x RET p helps? Unless C-h v default-process-coding-system is (utf-8-unix . utf-8-unix) try

(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!