UTF-8 in Emacs: Everywhere, Forever

This is how to force UTF8 in Emacs in all possible context.
Emacs is quite stubborn, but with this setup I haven’t run into trouble yet.

(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)
(when (display-graphic-p)
   (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))

One thought on “UTF-8 in Emacs: Everywhere, Forever

Leave a comment