50.4.5 Non-ASCII Characters in Init Files

Language and coding systems may cause problems if your init file contains non-ASCII characters, such as accented letters, in strings or key bindings.

If you want to use non-ASCII characters in your init file, you should put a ‘-*-coding: coding-system-*- tag on the first line of the init file, and specify a coding system that supports the character(s) in question. See Recognizing Coding Systems. This is because the defaults for decoding non-ASCII text might not yet be set up by the time Emacs reads those parts of your init file which use such strings, possibly leading Emacs to decode those strings incorrectly. You should then avoid adding Emacs Lisp code that modifies the coding system in other ways, such as calls to set-language-environment.

An alternative to using non-ASCII characters directly is to use one of the character escape syntaxes described in see General Escape Syntax in The Emacs Lisp Reference Manual, as they allow all Unicode codepoints to be specified using only ASCII characters.

To bind non-ASCII keys, you must use a vector (see Rebinding Keys in Your Init File). The string syntax cannot be used, since the non-ASCII characters will be interpreted as meta keys. For instance:

(global-set-key [?char] 'some-function)

Type C-q, followed by the key you want to bind, to insert char.