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


17.8 Specifying a Coding System

In cases where SXEmacs does not automatically choose the right coding system, you can use these commands to specify one:

C-x RET f coding RET

Use coding system coding for the visited file in the current buffer.

C-x RET c coding RET

Specify coding system coding for the immediately following command.

C-x RET k coding RET

Use coding system coding for keyboard input. (This feature is non-functional and is temporarily disabled.)

C-x RET t coding RET

Use coding system coding for terminal output.

C-x RET p coding RET

Use coding system coding for subprocess input and output in the current buffer.

The command C-x RET f (set-buffer-file-coding-system) specifies the file coding system for the current buffer—in other words, which coding system to use when saving or rereading the visited file. You specify which coding system using the minibuffer. Since this command applies to a file you have already visited, it affects only the way the file is saved.

Another way to specify the coding system for a file is when you visit the file. First use the command C-x RET c (universal-coding-system-argument); this command uses the minibuffer to read a coding system name. After you exit the minibuffer, the specified coding system is used for the immediately following command.

So if the immediately following command is C-x C-f, for example, it reads the file using that coding system (and records the coding system for when the file is saved). Or if the immediately following command is C-x C-w, it writes the file using that coding system. Other file commands affected by a specified coding system include C-x C-i and C-x C-v, as well as the other-window variants of C-x C-f.

In addition, if you run some file input commands with the precedent C-u, you can specify coding system to read from minibuffer. So if the immediately following command is C-x C-f, for example, it reads the file using that coding system (and records the coding system for when the file is saved). Other file commands affected by a specified coding system include C-x C-i and C-x C-v, as well as the other-window variants of C-x C-f.

The variable default-buffer-file-coding-system specifies the choice of coding system to use when you create a new file. It applies when you find a new file, and when you create a buffer and then save it in a file. Selecting a language environment typically sets this variable to a good choice of default coding system for that language environment.

The command C-x RET t (set-terminal-coding-system) specifies the coding system for terminal output. If you specify a character code for terminal output, all characters output to the terminal are translated into that coding system.

This feature is useful for certain character-only terminals built to support specific languages or character sets—for example, European terminals that support one of the ISO Latin character sets.

By default, output to the terminal is not translated at all.

The command C-x RET k (set-keyboard-coding-system) specifies the coding system for keyboard input. Character-code translation of keyboard input is useful for terminals with keys that send non-ASCII graphic characters—for example, some terminals designed for ISO Latin-1 or subsets of it.

By default, keyboard input is not translated at all.

There is a similarity between using a coding system translation for keyboard input, and using an input method: both define sequences of keyboard input that translate into single characters. However, input methods are designed to be convenient for interactive use by humans, and the sequences that are translated are typically sequences of ASCII printing characters. Coding systems typically translate sequences of non-graphic characters.

(This feature is non-functional and is temporarily disabled.)

The command C-x RET p (set-buffer-process-coding-system) specifies the coding system for input and output to a subprocess. This command applies to the current buffer; normally, each subprocess has its own buffer, and thus you can use this command to specify translation to and from a particular subprocess by giving the command in the corresponding buffer.

By default, process input and output are not translated at all.

The variable file-name-coding-system specifies a coding system to use for encoding file names. If you set the variable to a coding system name (as a Lisp symbol or a string), SXEmacs encodes file names using that coding system for all file operations. This makes it possible to use non-Latin-1 characters in file names—or, at least, those non-Latin-1 characters which the specified coding system can encode. By default, this variable is nil, which implies that you cannot use non-Latin-1 characters in file names.


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