Coding Systems
Users of various languages have established many more-or-less standard coding systems for representing them. Emacs does not use these coding systems internally; instead, it converts from various coding systems to its own system when reading data, and converts the internal coding system to other coding systems when writing data. Conversion is possible in reading or writing files, in sending or receiving from the terminal, and in exchanging data with subprocesses.
Emacs assigns a name to each coding system. Most coding systems are used for one language, and the name of the coding system starts with the language name. Some coding systems are used for several languages; their names usually start with iso. There are also special coding systems no-conversion, raw-text and emacs-mule which do not convert printing characters at all.
A special class of coding systems, collectively known as codepages, is designed to support text encoded by MS-Windows and MS-DOS software. To use any of these systems, you need to create it with M-x codepage-setup. See MS-DOS and MULE. After creating the coding system for the codepage, you can use it as any other coding system. For example, to visit a file encoded in codepage 850, type C-x <RET> c cp850 <RET> C-x C-f filename <RET>.
In addition to converting various representations of non-ASCII characters, a coding system can perform end-of-line conversion. Emacs handles three different conventions for how to separate lines in a file: newline, carriage-return linefeed, and just carriage-return.
- C-h C coding <RET>
Describe coding system coding. - C-h C <RET>
Describe the coding systems currently in use. - M-x list-coding-systems
Display a list of all the supported coding systems.
The command C-h C (describe-coding-system) displays information about particular coding systems. You can specify a coding system name as the argument; alternatively, with an empty argument, it describes the coding systems currently selected for various purposes, both in the current buffer and as the defaults, and the priority list for recognizing coding systems (see Recognize Coding).
To display a list of all the supported coding systems, type M-x list-coding-systems. The list gives information about each coding system, including the letter that stands for it in the mode line (see Mode Line).
Each of the coding systems that appear in this list--except for no-conversion, which means no conversion of any kind--specifies how and whether to convert printing characters, but leaves the choice of end-of-line conversion to be decided based on the contents of each file. For example, if the file appears to use the sequence carriage-return linefeed to separate lines, DOS end-of-line conversion will be used.
Each of the listed coding systems has three variants which specify exactly what to do for end-of-line conversion:
- ...-unix

