Next: , Previous: , Up: Mule   [Contents][Index]


17.6 Coding Systems

Users of various languages have established many more-or-less standard coding systems for representing them. SXEmacs 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.

SXEmacs 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 binary and no-conversion which do not convert printing characters at all.

In addition to converting various representations of non-ASCII characters, a coding system can perform end-of-line conversion. SXEmacs 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.

C-u M-x list-coding-systems

Display comprehensive list of specific details of all supported coding systems.

The command C-x RET C (describe-coding-system) displays information about particular coding systems. You can specify a coding system name as 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 binary, 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 carriage-return linefeed between lines, that 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

Don’t do any end-of-line conversion; assume the file uses newline to separate lines. (This is the convention normally used on Unix and GNU systems.)

…-dos

Assume the file uses carriage-return linefeed to separate lines, and do the appropriate conversion. (This is the convention normally used on Microsoft systems.)

…-mac

Assume the file uses carriage-return to separate lines, and do the appropriate conversion. (This is the convention normally used on the Macintosh system.)

These variant coding systems are omitted from the list-coding-systems display for brevity, since they are entirely predictable. For example, the coding system iso-8859-1 has variants iso-8859-1-unix, iso-8859-1-dos and iso-8859-1-mac.

In contrast, the coding system binary specifies no character code conversion at all—none for non-Latin-1 byte values and none for end of line. This is useful for reading or writing binary files, tar files, and other files that must be examined verbatim.

The easiest way to edit a file with no conversion of any kind is with the M-x find-file-literally command. This uses binary, and also suppresses other SXEmacs features that might convert the file contents before you see them. See Visiting.

The coding system no-conversion means that the file contains non-Latin-1 characters stored with the internal SXEmacs encoding. It handles end-of-line conversion based on the data encountered, and has the usual three variants to specify the kind of end-of-line conversion.


Next: , Previous: , Up: Mule   [Contents][Index]