Using the configuration

(eval-after-load "em-term"
     (add-to-list 'eshell-visual-subcommands '("git" "diff" "help" "log" "show"))
     (add-to-list 'eshell-visual-options '("git" "--help" "--paginate"))))

eshell opens git help diff in a term-mode buffer. The buffer file coding system of this buffer is set to utf-8.

Even so utf-8 characters in the output of git help diff are shown as octal codes (see doesn't in the last line):

    Without this flag, git log -p <path>...  shows commits that touch the specified paths, and diffs about the same specified paths. With this, the full diff is shown for commits that touch the
    specified paths; this means that "<path>..." limits only commits, and doesn\342\200\231t limit diff for those commits.

I assume that the problem is connected to the following section of the function term-exec-1:

;; The process's output contains not just chars but also binary
;; escape codes, so we need to see the raw output.  We will have to
;; do the decoding by hand on the parts that are made of chars.
(coding-system-for-read 'binary)

Is there a workaround?

I 've tried the method described in "Unicode characters in emacs term-mode". They don't work.

1 Answer 1


I found the lines

;; display of certain characters and control codes to UTF-8
(defun my-term-use-utf8 ()
  (set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))
(add-hook 'term-exec-hook 'my-term-use-utf8)

in the ansi-term configuration of user space_voyager in his question "ansi-term changes in line-mode not registered after char-mode".

These lines work for me (emacs 25.2.1 on cygwin).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.