[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

33.9 Translation of Characters

A translation table is a char-table that specifies a mapping of characters into characters. These tables are used in encoding and decoding, and for other purposes. Some coding systems specify their own particular translation tables; there are also default translation tables which apply to all other coding systems.

For instance, the coding-system utf-8 has a translation table that maps characters of various charsets (e.g., latin-iso8859-x) into Unicode character sets. This way, it can encode Latin-2 characters into UTF-8. Meanwhile, unify-8859-on-decoding-mode operates by specifying standard-translation-table-for-decode to translate Latin-x characters into corresponding Unicode characters.

Function: make-translation-table &rest translations

This function returns a translation table based on the argument translations. Each element of translations should be a list of elements of the form (from . to); this says to translate the character from into to.

The arguments and the forms in each argument are processed in order, and if a previous form already translates to to some other character, say to-alt, from is also translated to to-alt.

You can also map one whole character set into another character set with the same dimension. To do this, you specify a generic character (which designates a character set) for from (voir la section Splitting Characters). In this case, if to is also a generic character, its character set should have the same dimension as from's. Then the translation table translates each character of from's character set into the corresponding character of to's character set. If from is a generic character and to is an ordinary character, then the translation table translates every character of from's character set into to.

In decoding, the translation table's translations are applied to the characters that result from ordinary decoding. If a coding system has property translation-table-for-decode, that specifies the translation table to use. (This is a property of the coding system, as returned by coding-system-get, not a property of the symbol that is the coding system's name. Voir la section Basic Concepts of Coding Systems.) Otherwise, if standard-translation-table-for-decode is non-nil, decoding uses that table.

In encoding, the translation table's translations are applied to the characters in the buffer, and the result of translation is actually encoded. If a coding system has property translation-table-for-encode, that specifies the translation table to use. Otherwise the variable standard-translation-table-for-encode specifies the translation table.

Variable: standard-translation-table-for-decode

This is the default translation table for decoding, for coding systems that don't specify any other translation table.

Variable: standard-translation-table-for-encode

This is the default translation table for encoding, for coding systems that don't specify any other translation table.

Variable: translation-table-for-input

Self-inserting characters are translated through this translation table before they are inserted. Search commands also translate their input through this table, so they can compare more reliably with what's in the buffer.

set-buffer-file-coding-system sets this variable so that your keyboard input gets translated into the character sets that the buffer is likely to contain. This variable automatically becomes buffer-local when set.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.