Emacs, UTF-8 and German Umlaute

I use Ubuntu 7.04 Feisty Fawn and emacs-nox 21.4.1. As the GNOME environment uses UTF-8 but emacs doesn’t recognize it, I couldn’t insert german umlaute du to the emacs keyboard-coding-system. To solve this problem I added the following lisp code to my ~/.emacs file. It figures out if the language environment is set to UTF-8 and changes the necessary variables.

(if (string-match “UTF” (getenv “LANG”))
(progn
(setq locale-coding-system ‘utf-8)
(set-terminal-coding-system ‘utf-8)
(set-keyboard-coding-system ‘utf-8)
(set-selection-coding-system ‘utf-8)
(prefer-coding-system ‘utf-8))
)

Leave a Reply