@findex set-language-environment
@vindex current-language-environment
- To select a language environment, customize the option
+ To select a language environment, you can customize the variable
@code{current-language-environment} or use the command @kbd{M-x
set-language-environment}. It makes no difference which buffer is
current when you use this command, because the effects apply globally to
reasons to specify a language environment.
@findex prefer-coding-system
- However, you can alter the priority list in detail with the command
-@kbd{M-x prefer-coding-system}. This command reads the name of a coding
-system from the minibuffer, and adds it to the front of the priority
-list, so that it is preferred to all others. If you use this command
-several times, each use adds one element to the front of the priority
-list.
+ However, you can alter the coding system priority list in detail
+with the command @kbd{M-x prefer-coding-system}. This command reads
+the name of a coding system from the minibuffer, and adds it to the
+front of the priority list, so that it is preferred to all others. If
+you use this command several times, each use adds one element to the
+front of the priority list.
If you use a coding system that specifies the end-of-line conversion
type, such as @code{iso-8859-1-dos}, what this means is that Emacs
@vindex auto-coding-alist
@vindex auto-coding-regexp-alist
- The variables @code{auto-coding-alist} and
-@code{auto-coding-regexp-alist} are the strongest way to specify the
-coding system for certain patterns of file names, or for files
-containing certain patterns; these variables even override
-@samp{-*-coding:-*-} tags in the file itself. Emacs uses
-@code{auto-coding-alist} for tar and archive files, to prevent it
+@vindex auto-coding-functions
+ The variables @code{auto-coding-alist},
+@code{auto-coding-regexp-alist} and @code{auto-coding-functions} are
+the strongest way to specify the coding system for certain patterns of
+file names, or for files containing certain patterns; these variables
+even override @samp{-*-coding:-*-} tags in the file itself. Emacs
+uses @code{auto-coding-alist} for tar and archive files, to prevent it
from being confused by a @samp{-*-coding:-*-} tag in a member of the
archive and thinking it applies to the archive file as a whole.
Likewise, Emacs uses @code{auto-coding-regexp-alist} to ensure that
-RMAIL files, whose names in general don't match any particular pattern,
-are decoded correctly.
+RMAIL files, whose names in general don't match any particular
+pattern, are decoded correctly. One of the builtin
+@code{auto-coding-functions} detects the encoding for XML files.
If Emacs recognizes the encoding of a file incorrectly, you can
reread the file using the correct coding system by typing @kbd{C-x
the file, look at the coding system mnemonic letter near the left edge
of the mode line (@pxref{Mode Line}), or type @kbd{C-h C @key{RET}}.
+@findex unify-8859-on-decoding-mode
+ The command @code{unify-8859-on-decoding-mode} enables a mode that
+``unifies'' the Latin alphabets when decoding text. This works by
+converting all non-ASCII Latin-@var{n} characters to either Latin-1 or
+Unicode characters. This way it is easier to use various
+Latin-@var{n} alphabets together. In a future Emacs version we hope
+to move towards full Unicode support and complete unification of
+character sets.
+
@vindex buffer-file-coding-system
Once Emacs has chosen a coding system for a buffer, it stores that
coding system in @code{buffer-file-coding-system} and uses that coding
@table @kbd
@item C-x @key{RET} f @var{coding} @key{RET}
-Use coding system @var{coding} for the visited file
-in the current buffer.
+Use coding system @var{coding} for saving or revisiting the visited
+file in the current buffer.
@item C-x @key{RET} c @var{coding} @key{RET}
Specify coding system @var{coding} for the immediately following
@kindex C-x RET f
@findex set-buffer-file-coding-system
- The command @kbd{C-x @key{RET} f} (@code{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.
+ The command @kbd{C-x @key{RET} f}
+(@code{set-buffer-file-coding-system}) sets the file coding system for
+the current buffer---in other words, it says which coding system to
+use when saving or reverting the visited file. You specify which
+coding system using the minibuffer. If you specify a coding system
+that cannot handle all of the characters in the buffer, Emacs warns
+you about the troublesome characters when you actually save the
+buffer.
@kindex C-x RET c
@findex universal-coding-system-argument
So if the immediately following command is @kbd{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
+system for when you later save the file). Or if the immediately following
command is @kbd{C-x C-w}, it writes the file using that coding system.
-Other file commands affected by a specified coding system include
-@kbd{C-x C-i} and @kbd{C-x C-v}, as well as the other-window variants of
-@kbd{C-x C-f}.
+When you specify the coding system for saving in this way, instead
+of with @kbd{C-x @key{RET} f}, there is no warning if the buffer
+contains characters that the coding system cannot handle.
- @kbd{C-x @key{RET} c} also affects commands that start subprocesses,
-including @kbd{M-x shell} (@pxref{Shell}).
+ Other file commands affected by a specified coding system include
+@kbd{C-x C-i} and @kbd{C-x C-v}, as well as the other-window variants
+of @kbd{C-x C-f}. @kbd{C-x @key{RET} c} also affects commands that
+start subprocesses, including @kbd{M-x shell} (@pxref{Shell}).
- However, if the immediately following command does not use the coding
-system, then @kbd{C-x @key{RET} c} ultimately has no effect.
+ If the immediately following command does not use the coding system,
+then @kbd{C-x @key{RET} c} ultimately has no effect.
An easy way to visit a file with no conversion is with the @kbd{M-x
find-file-literally} command. @xref{Visiting}.
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.
+ By default, keyboard input is translated based on your system locale
+setting. If your terminal does not really support the encoding
+implied by your locale (for example, if you find it inserts a
+non-ASCII character if you type @kbd{M-i}), you will need to set
+@code{keyboard-coding-system} to @code{nil} to turn off encoding.
+You can do this by putting
+
+@lisp
+(set-keyboard-coding-system nil)
+@end lisp
+
+@noindent
+in your @file{~/.emacs} file.
There is a similarity between using a coding system translation for
keyboard input, and using an input method: both define sequences of
@node Undisplayable Characters
@section Undisplayable Characters
- Your terminal may be unable to display some non-ASCII
-characters. Most non-windowing terminals can only use a single
-character set (use the variable @code{default-terminal-coding-system}
+ There may be a some non-ASCII characters that your terminal cannot
+display. Most non-windowing terminals support just a single character
+set (use the variable @code{default-terminal-coding-system}
(@pxref{Specify Coding}) to tell Emacs which one); characters which
can't be encoded in that coding system are displayed as @samp{?} by
default.