manpagez: man pages & more
info emacs
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

27.9 Specifying a File's Coding System

If Emacs recognizes the encoding of a file incorrectly, you can reread the file using the correct coding system by typing C-x <RET> r coding-system <RET>. To see what coding system Emacs actually used to decode the file, look at the coding system mnemonic letter near the left edge of the mode line (see section The Mode Line), or type C-h C <RET>.

You can specify the coding system for a particular file in the file itself, using the ‘-*-…-*-’ construct at the beginning, or a local variables list at the end (see section Local Variables in Files). You do this by defining a value for the “variable” named coding. Emacs does not really have a variable coding; instead of setting a variable, this uses the specified coding system for the file. For example, ‘-*-mode: C; coding: latin-1;-*-’ specifies use of the Latin-1 coding system, as well as C mode. When you specify the coding explicitly in the file, that overrides file-coding-system-alist.

If you add the character ‘!’ at the end of the coding system name in coding, it disables any character translation (see Character Translation) while decoding the file. This is useful when you need to make sure that the character codes in the Emacs buffer will not vary due to changes in user settings; for instance, for the sake of strings in Emacs Lisp source files.


© manpagez.com 2000-2017
Individual documents may contain additional copyright information.