Previous: Find Init, Up: Init File

49.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 Recognize Coding. 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.

To bind non-ASCII keys, you must use a vector (see Init Rebinding). 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.