Emacs, Japanese, Putty, Windows, and text entry

I don’t know why but I have had to set this up a few times now. If you try writing Japanese via Putty into Emacs, and things do not work for you (instead it looks like Emacs is interpreting things as control characters in some way) then the following magic incantation might help you:


;; Set up Japanese input and coding systems
(set-language-environment "Japanese")
(set-terminal-coding-system 'utf-8-unix)
(set-default-coding-systems 'utf-8-unix)
(set-buffer-file-coding-system 'utf-8-unix)
(prefer-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'utf-8) ; This is the magic for windows putty Japanese input

The important bit is the set-keyboard-coding-system. The other things are important to some degree, but the keyboard setting is what determines whether emacs will beep at you or put up some pretty Japanese text.

I actually have Putty, Emacs, and Gnu Screen all playing nicely together now, which is great. But this is only true for version 23.x of Emacs, since 22.x doesn’t seem to play well with Japanese in a terminal under screen…


Posted

in

by

Tags:

Comments

One response to “Emacs, Japanese, Putty, Windows, and text entry”

  1. Matt Avatar

    Oh man. I remember being super frustrated trying to get that to work last time.

Leave a Reply

Your email address will not be published. Required fields are marked *