]> code.delx.au - gnu-emacs/blobdiff - man/mule.texi
(Font Lock): Suggest more user-friendly method of
[gnu-emacs] / man / mule.texi
index 059b261cbece2c2720f2ddab07afb7c122ec2149..fa5e1246f251555749e4a07576da7b0f68c8e250 100644 (file)
@@ -1,5 +1,6 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+@c Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004,
+@c   2005 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node International, Major Modes, Frames, Top
 @chapter International Character Set Support
 @cindex Dutch
 @cindex Spanish
   Emacs supports a wide variety of international character sets,
-including European variants of the Latin alphabet, as well as Chinese,
-Cyrillic, Devanagari (Hindi and Marathi), Ethiopic, Greek, Hebrew, IPA,
-Japanese, Korean, Lao, Thai, Tibetan, and Vietnamese scripts.  These features
-have been merged from the modified version of Emacs known as MULE (for
-``MULti-lingual Enhancement to GNU Emacs'')
+including European and Vietnamese variants of the Latin alphabet, as
+well as Cyrillic, Devanagari (for Hindi and Marathi), Ethiopic, Greek,
+Han (for Chinese and Japanese), Hangul (for Korean), Hebrew, IPA,
+Kannada, Lao, Malayalam, Tamil, Thai, Tibetan, and Vietnamese scripts.
+These features have been merged from the modified version of Emacs
+known as MULE (for ``MULti-lingual Enhancement to GNU Emacs'')
 
   Emacs also supports various encodings of these characters used by
 other internationalized software, such as word processors and mailers.
@@ -49,8 +51,8 @@ all the related activities:
 
 @itemize @bullet
 @item
-You can visit files with non-ASCII characters, save non-ASCII text, and
-pass non-ASCII text between Emacs and programs it invokes (such as
+You can visit files with non-@acronym{ASCII} characters, save non-@acronym{ASCII} text, and
+pass non-@acronym{ASCII} text between Emacs and programs it invokes (such as
 compilers, spell-checkers, and mailers).  Setting your language
 environment (@pxref{Language Environments}) takes care of setting up the
 coding systems and other options for a specific language or culture.
@@ -58,7 +60,7 @@ Alternatively, you can specify how Emacs should encode or decode text
 for each command; see @ref{Specify Coding}.
 
 @item
-You can display non-ASCII characters encoded by the various scripts.
+You can display non-@acronym{ASCII} characters encoded by the various scripts.
 This works by using appropriate fonts on X and similar graphics
 displays (@pxref{Defining Fontsets}), and by sending special codes to
 text-only displays (@pxref{Specify Coding}).  If some characters are
@@ -66,16 +68,17 @@ displayed incorrectly, refer to @ref{Undisplayable Characters}, which
 describes possible problems and explains how to solve them.
 
 @item
-You can insert non-ASCII characters or search for them.  To do that,
+You can insert non-@acronym{ASCII} characters or search for them.  To do that,
 you can specify an input method (@pxref{Select Input Method}) suitable
 for your language, or use the default input method set up when you set
-your language environment.  (Emacs input methods are part of the Leim
-package, which must be installed for you to be able to use them.)  If
-your keyboard can produce non-ASCII characters, you can select an
+your language environment.  If
+your keyboard can produce non-@acronym{ASCII} characters, you can select an
 appropriate keyboard coding system (@pxref{Specify Coding}), and Emacs
 will accept those characters.  Latin-1 characters can also be input by
 using the @kbd{C-x 8} prefix, see @ref{Single-Byte Character Support,
-C-x 8}.
+C-x 8}.  On X Window systems, your locale should be set to an
+appropriate value to make sure Emacs interprets keyboard input
+correctly; see @ref{Language Environments, locales}.
 @end itemize
 
   The rest of this chapter describes these issues in detail.
@@ -95,9 +98,9 @@ C-x 8}.
                               that cover the whole spectrum of characters.
 * Defining Fontsets::       Defining a new fontset.
 * Undisplayable Characters:: When characters don't display.
-* Single-Byte Character Support::
-                            You can pick one European character set
-                            to use without multibyte characters.
+* Single-Byte Character Support:: You can pick one European character set
+                              to use without multibyte characters.
+* Charsets::                How Emacs groups its internal character codes.
 @end menu
 
 @node International Chars
@@ -107,7 +110,7 @@ C-x 8}.
 many more-or-less standard coding systems for storing files.  Emacs
 internally uses a single multibyte character encoding, so that it can
 intermix characters from all these scripts in a single buffer or string.
-This encoding represents each non-ASCII character as a sequence of bytes
+This encoding represents each non-@acronym{ASCII} character as a sequence of bytes
 in the range 0200 through 0377.  Emacs translates between the multibyte
 character encoding and various other coding systems when reading and
 writing files, when exchanging data with subprocesses, and (in some
@@ -132,28 +135,6 @@ language, to make it convenient to type them.
   The prefix key @kbd{C-x @key{RET}} is used for commands that pertain
 to multibyte characters, coding systems, and input methods.
 
-@ignore
-@c This is commented out because it doesn't fit here, or anywhere.
-@c This manual does not discuss "character sets" as they
-@c are used in Mule, and it makes no sense to mention these commands
-@c except as part of a larger discussion of the topic.
-@c But it is not clear that topic is worth mentioning here,
-@c since that is more of an implementation concept
-@c than a user-level concept.  And when we switch to Unicode,
-@c character sets in the current sense may not even exist.
-
-@findex list-charset-chars
-@cindex characters in a certain charset
-  The command @kbd{M-x list-charset-chars} prompts for a name of a
-character set, and displays all the characters in that character set.
-
-@findex describe-character-set
-@cindex character set, description
-  The command @kbd{M-x describe-character-set} prompts for a character
-set name and displays information about that character set, including
-its internal representation within Emacs.
-@end ignore
-
 @node Enabling Multibyte
 @section Enabling Multibyte Characters
 
@@ -206,23 +187,23 @@ in that buffer.
 @cindex Lisp files, and multibyte operation
 @cindex multibyte operation, and Lisp files
 @cindex unibyte operation, and Lisp files
-@cindex init file, and non-ASCII characters
-@cindex environment variables, and non-ASCII characters
+@cindex init file, and non-@acronym{ASCII} characters
+@cindex environment variables, and non-@acronym{ASCII} characters
   With @samp{--unibyte}, multibyte strings are not created during
 initialization from the values of environment variables,
-@file{/etc/passwd} entries etc.@: that contain non-ASCII 8-bit
+@file{/etc/passwd} entries etc.@: that contain non-@acronym{ASCII} 8-bit
 characters.
 
   Emacs normally loads Lisp files as multibyte, regardless of whether
-you used @samp{--unibyte}.  This includes the Emacs initialization
-file, @file{.emacs}, and the initialization files of Emacs packages
-such as Gnus.  However, you can specify unibyte loading for a
-particular Lisp file, by putting @w{@samp{-*-unibyte: t;-*-}} in a
-comment on the first line.  Then that file is always loaded as unibyte
-text, even if you did not start Emacs with @samp{--unibyte}.  The
-motivation for these conventions is that it is more reliable to always
-load any particular Lisp file in the same way.  However, you can load
-a Lisp file as unibyte, on any one occasion, by typing @kbd{C-x
+you used @samp{--unibyte}.  This includes the Emacs initialization file,
+@file{.emacs}, and the initialization files of Emacs packages such as
+Gnus.  However, you can specify unibyte loading for a particular Lisp
+file, by putting @w{@samp{-*-unibyte: t;-*-}} in a comment on the first
+line (@pxref{File Variables}).  Then that file is always loaded as
+unibyte text, even if you did not start Emacs with @samp{--unibyte}.
+The motivation for these conventions is that it is more reliable to
+always load any particular Lisp file in the same way.  However, you can
+load a Lisp file as unibyte, on any one occasion, by typing @kbd{C-x
 @key{RET} c raw-text @key{RET}} immediately before loading it.
 
   The mode line indicates whether multibyte character support is enabled
@@ -251,7 +232,7 @@ Each language environment also specifies a default input method.
 
 @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
@@ -260,13 +241,19 @@ the Emacs session.  The supported language environments include:
 @cindex Euro sign
 @cindex UTF-8
 @quotation
-Chinese-BIG5, Chinese-CNS, Chinese-GB, Cyrillic-ALT, Cyrillic-ISO,
-Cyrillic-KOI8, Czech, Devanagari, Dutch, English, Ethiopic, German,
-Greek, Hebrew, IPA, Japanese, Korean, Lao, Latin-1, Latin-2, Latin-3,
-Latin-4, Latin-5, Latin-8 (Celtic), Latin-9 (updated Latin-1, with the
-Euro sign), Polish, Romanian, Slovak, Slovenian, Spanish, Thai, Tibetan,
-Turkish, UTF-8 (for a setup which prefers Unicode characters and files
-encoded in UTF-8), and Vietnamese.
+Belarusian, Brazilian Portuguese, Bulgarian, Chinese-BIG5,
+Chinese-CNS, Chinese-EUC-TW, Chinese-GB, Croatian, Cyrillic-ALT,
+Cyrillic-ISO, Cyrillic-KOI8, Czech, Devanagari, Dutch, English,
+Ethiopic, French, Georgian, German, Greek, Hebrew, IPA, Italian,
+Japanese, Kannada, Korean, Lao, Latin-1, Latin-2, Latin-3,
+Latin-4, Latin-5, Latin-6, Latin-7, Latin-8 (Celtic),
+Latin-9 (updated Latin-1 with the Euro sign), Latvian,
+Lithuanian, Malayalam, Polish, Romanian, Russian, Slovak,
+Slovenian, Spanish, Swedish, Tajik, Tamil, Thai, Tibetan,
+Turkish, UTF-8 (for a setup which prefers Unicode characters and
+files encoded in UTF-8), Ukrainian, Vietnamese, Welsh, and
+Windows-1255 (for a setup which prefers Cyrillic characters and
+files encoded in Windows-1255).
 @end quotation
 
 @cindex fonts for various scripts
@@ -274,7 +261,7 @@ encoded in UTF-8), and Vietnamese.
   To display the script(s) used by your language environment on a
 graphical display, you need to have a suitable font.  If some of the
 characters appear as empty boxes, you should install the GNU Intlfonts
-package, which includes fonts for all supported scripts.@footnote{If
+package, which includes fonts for most supported scripts.@footnote{If
 you run Emacs on X, you need to inform the X server about the location
 of the newly installed fonts with the following commands:
 
@@ -299,8 +286,9 @@ against entries in the value of the variables
 @code{locale-charset-language-names} and @code{locale-language-names},
 and selects the corresponding language environment if a match is found.
 (The former variable overrides the latter.)  It also adjusts the display
-table and terminal coding system, the locale coding system, and the
-preferred coding system as needed for the locale.
+table and terminal coding system, the locale coding system, the
+preferred coding system as needed for the locale, and---last but not
+least---the way Emacs decodes non-@acronym{ASCII} characters sent by your keyboard.
 
   If you modify the @env{LC_ALL}, @env{LC_CTYPE}, or @env{LANG}
 environment variables while running Emacs, you may want to invoke the
@@ -364,14 +352,14 @@ has its own input method; sometimes several languages which use the same
 characters can share one input method.  A few languages support several
 input methods.
 
-  The simplest kind of input method works by mapping ASCII letters
+  The simplest kind of input method works by mapping @acronym{ASCII} letters
 into another alphabet; this allows you to use one other alphabet
-instead of ASCII.  The Greek and Russian input methods
+instead of @acronym{ASCII}.  The Greek and Russian input methods
 work this way.
 
   A more powerful technique is composition: converting sequences of
 characters into one letter.  Many European input methods use composition
-to produce a single non-ASCII letter from a sequence that consists of a
+to produce a single non-@acronym{ASCII} letter from a sequence that consists of a
 letter followed by accent characters (or vice versa).  For example, some
 methods convert the sequence @kbd{a'} into a single accented letter.
 These input methods have no special commands of their own; all they do
@@ -446,6 +434,9 @@ is the command @kbd{C-\} (@code{toggle-input-method}) used twice.
 because it stops waiting for more characters to combine, and starts
 searching for what you have already entered.
 
+  To find out how to input the character after point using the current
+input method, type @kbd{C-u C-x =}.  @xref{Position Info}.
+
 @vindex input-method-verbose-flag
 @vindex input-method-highlight-flag
   The variables @code{input-method-highlight-flag} and
@@ -457,12 +448,6 @@ most input methods---some disable this feature).  If
 possible characters to type next is displayed in the echo area (but
 not when you are in the minibuffer).
 
-@cindex Leim package
-  Input methods are implemented in the separate Leim package: they are
-available only if the system administrator used Leim when building
-Emacs.  If Emacs was built without Leim, you will find that no input
-methods are defined.
-
 @node Select Input Method
 @section Selecting an Input Method
 
@@ -495,11 +480,11 @@ Display a list of all the supported input methods.
 input method name from the minibuffer; the name normally starts with the
 language environment that it is meant to be used with.  The variable
 @code{current-input-method} records which input method is selected.
-  
+
 @findex toggle-input-method
 @kindex C-\
-  Input methods use various sequences of ASCII characters to stand for
-non-ASCII characters.  Sometimes it is useful to turn off the input
+  Input methods use various sequences of @acronym{ASCII} characters to stand for
+non-@acronym{ASCII} characters.  Sometimes it is useful to turn off the input
 method temporarily.  To do this, type @kbd{C-\}
 (@code{toggle-input-method}).  To reenable the input method, type
 @kbd{C-\} again.
@@ -546,17 +531,24 @@ for those scripts.  How to do this remapping properly depends on your
 actual keyboard layout.  To specify which layout your keyboard has, use
 the command @kbd{M-x quail-set-keyboard-layout}.
 
+@findex quail-show-key
+  You can use the command @kbd{M-x quail-show-key} to show what key (or
+key sequence) to type in order to input the character following point,
+using the selected keyboard layout.  The command @kbd{C-u C-x =} also
+shows that information in addition to the other information about the
+character.
+
 @findex list-input-methods
   To display a list of all the supported input methods, type @kbd{M-x
 list-input-methods}.  The list gives information about each input
 method, including the string that stands for it in the mode line.
 
 @node Multibyte Conversion
-@section Unibyte and Multibyte Non-ASCII characters
+@section Unibyte and Multibyte Non-@acronym{ASCII} characters
 
   When multibyte characters are enabled, character codes 0240 (octal)
 through 0377 (octal) are not really legitimate in the buffer.  The valid
-non-ASCII printing characters have codes that start from 0400.
+non-@acronym{ASCII} printing characters have codes that start from 0400.
 
   If you type a self-inserting character in the range 0240 through
 0377, or if you use @kbd{C-q} to insert one, Emacs assumes you
@@ -601,14 +593,17 @@ coding systems @code{no-conversion}, @code{raw-text} and
 @cindex international files from DOS/Windows systems
   A special class of coding systems, collectively known as
 @dfn{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 @kbd{M-x codepage-setup}.  @xref{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 @kbd{C-x @key{RET} c cp850 @key{RET} C-x C-f @var{filename}
-@key{RET}}.
-
-  In addition to converting various representations of non-ASCII
+MS-DOS software.  The names of these coding systems are
+@code{cp@var{nnnn}}, where @var{nnnn} is a 3- or 4-digit number of the
+codepage.  You can use these encodings just like any other coding
+system; for example, to visit a file encoded in codepage 850, type
+@kbd{C-x @key{RET} c cp850 @key{RET} C-x C-f @var{filename}
+@key{RET}}@footnote{
+In the MS-DOS port of Emacs, you need to create a @code{cp@var{nnn}}
+coding system with @kbd{M-x codepage-setup}, before you can use it.
+@xref{MS-DOS and MULE}.}.
+
+  In addition to converting various representations of non-@acronym{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.
@@ -679,8 +674,8 @@ variants @code{iso-latin-1-unix}, @code{iso-latin-1-dos} and
 @code{iso-latin-1-mac}.
 
   The coding system @code{raw-text} is good for a file which is mainly
-ASCII text, but may contain byte values above 127 which are not meant to
-encode non-ASCII characters.  With @code{raw-text}, Emacs copies those
+@acronym{ASCII} text, but may contain byte values above 127 which are not meant to
+encode non-@acronym{ASCII} characters.  With @code{raw-text}, Emacs copies those
 byte values unchanged, and sets @code{enable-multibyte-characters} to
 @code{nil} in the current buffer so that they will be interpreted
 properly.  @code{raw-text} handles end-of-line conversion in the usual
@@ -688,7 +683,7 @@ way, based on the data encountered, and has the usual three variants to
 specify the kind of end-of-line conversion to use.
 
   In contrast, the coding system @code{no-conversion} specifies no
-character code conversion at all---none for non-ASCII byte values and
+character code conversion at all---none for non-@acronym{ASCII} 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.  It,
 too, sets @code{enable-multibyte-characters} to @code{nil}.
@@ -699,7 +694,7 @@ the @kbd{M-x find-file-literally} command.  This uses
 might convert the file contents before you see them.  @xref{Visiting}.
 
   The coding system @code{emacs-mule} means that the file contains
-non-ASCII characters stored with the internal Emacs encoding.  It
+non-@acronym{ASCII} characters stored with the internal Emacs 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.
 
@@ -732,12 +727,12 @@ Czech, you probably want Latin-2 to be preferred.  This is one of the
 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
@@ -753,7 +748,7 @@ example, to read and write all @samp{.txt} files using the coding system
 @code{china-iso-8bit}, you can execute this Lisp expression:
 
 @smallexample
-(modify-coding-system-alist 'file "\\.txt\\'" 'china-iso-8bit)
+(modify-coding-system-alist 'file "\\.txt\\'" 'chinese-iso-8bit)
 @end smallexample
 
 @noindent
@@ -792,7 +787,7 @@ the buffer.
   The default value of @code{inhibit-iso-escape-detection} is
 @code{nil}.  We recommend that you not change it permanently, only for
 one specific operation.  That's because many Emacs Lisp source files
-in the Emacs distribution contain non-ASCII characters encoded in the
+in the Emacs distribution contain non-@acronym{ASCII} characters encoded in the
 coding system @code{iso-2022-7bit}, and they won't be
 decoded correctly when you visit those files if you suppress the
 escape sequence detection.
@@ -811,25 +806,36 @@ explicitly in the file, that overrides
 
 @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
-@key{RET} c @var{coding-system} @key{RET} M-x revert-buffer
+@key{RET} r @var{coding-system}
 @key{RET}}.  To see what coding system Emacs actually used to decode
 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-@acronym{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
@@ -844,7 +850,7 @@ Coding}).
 most coding systems can only handle some of the possible characters.
 This means that it is possible for you to insert characters that
 cannot be encoded with the coding system that will be used to save the
-buffer.  For example, you could start with an ASCII file and insert a
+buffer.  For example, you could start with an @acronym{ASCII} file and insert a
 few Latin-1 characters into it, or you could edit a text file in
 Polish encoded in @code{iso-8859-2} and add some Russian words to it.
 When you save the buffer, Emacs cannot use the current value of
@@ -903,13 +909,16 @@ system, you can use these commands to specify one:
 
 @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
 command.
 
+@item C-x @key{RET} r @var{coding} @key{RET}
+Revisit the current file using the coding system @var{coding}.
+
 @item C-x @key{RET} k @var{coding} @key{RET}
 Use coding system @var{coding} for keyboard input.
 
@@ -924,19 +933,30 @@ subprocess input and output in the current buffer.
 Use coding system @var{coding} for transferring selections to and from
 other programs through the window system.
 
+@item C-x @key{RET} F @var{coding} @key{RET}
+Use coding system @var{coding} for encoding and decoding file
+@emph{names}.  This affects the use of non-ASCII characters in file
+names.  It has no effect on reading and writing the @emph{contents} of
+files.
+
 @item C-x @key{RET} X @var{coding} @key{RET}
 Use coding system @var{coding} for transferring @emph{one}
 selection---the next one---to or from the window system.
+
+@item M-x recode-region
+Convert the region from a previous coding system to a new one.
 @end table
 
 @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
@@ -949,17 +969,19 @@ command}.
 
   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}.
@@ -972,6 +994,12 @@ in a file.  Selecting a language environment typically sets this
 variable to a good choice of default coding system for that language
 environment.
 
+@kindex C-x RET r
+@findex revert-buffer-with-coding-system
+  If you visit a file with a wrong coding system, you can correct this
+with @kbd{C-x @key{RET} r} (@code{revert-buffer-with-coding-system}).
+This visits the current file again, using a coding system you specify.
+
 @kindex C-x RET t
 @findex set-terminal-coding-system
   The command @kbd{C-x @key{RET} t} (@code{set-terminal-coding-system})
@@ -993,19 +1021,31 @@ your locale specification (@pxref{Language Environments}).
 @findex set-keyboard-coding-system
 @vindex keyboard-coding-system
   The command @kbd{C-x @key{RET} k} (@code{set-keyboard-coding-system})
-or the Custom option @code{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.
+or the variable @code{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-@acronym{ASCII}
+graphic characters---for example, some terminals designed for ISO
+Latin-1 or subsets of it.
+
+  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-@acronym{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
 
-  By default, keyboard input is not translated at all.
+@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
 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
+the sequences that are translated are typically sequences of @acronym{ASCII}
 printing characters.  Coding systems typically translate sequences of
 non-graphic characters.
 
@@ -1033,18 +1073,28 @@ corresponding buffer.
   The default for translation of process input and output depends on the
 current language environment.
 
+@findex recode-region
+  If a piece of text has already been inserted into a buffer using the
+wrong coding system, you can decode it again using @kbd{M-x
+recode-region}.  This prompts you for the old coding system and the
+desired coding system, and acts on the text in the region.
+
 @vindex file-name-coding-system
-@cindex file names with non-ASCII characters
-  The variable @code{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), Emacs encodes file names
-using that coding system for all file operations.  This makes it
-possible to use non-ASCII characters in file names---or, at least, those
-non-ASCII characters which the specified coding system can encode.
+@cindex file names with non-@acronym{ASCII} characters
+@findex set-file-name-coding-system
+@kindex C-x @key{RET} F
+  The variable @code{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), Emacs encodes file
+names using that coding system for all file operations.  This makes it
+possible to use non-@acronym{ASCII} characters in file names---or, at
+least, those non-@acronym{ASCII} characters which the specified coding
+system can encode.  Use @kbd{C-x @key{RET} F}
+(@code{set-file-name-coding-system}) to specify this interactively.
 
   If @code{file-name-coding-system} is @code{nil}, Emacs uses a default
 coding system determined by the selected language environment.  In the
-default language environment, any non-ASCII characters in file names are
+default language environment, any non-@acronym{ASCII} characters in file names are
 not encoded specially; they appear in the file system using the internal
 Emacs representation.
 
@@ -1057,15 +1107,24 @@ these buffers under the visited file name, saving may use the wrong file
 name, or it may get an error.  If such a problem happens, use @kbd{C-x
 C-w} to specify a new file name for that buffer.
 
+@findex recode-file-name
+  If a mistake occurs when encoding a file name, use the command
+@kbd{M-x recode-file-name} to change the file name's coding
+system.  This prompts for an existing file name, its old coding
+system, and the coding system to which you wish to convert.
+
 @vindex locale-coding-system
+@cindex decoding non-@acronym{ASCII} keyboard input on X
   The variable @code{locale-coding-system} specifies a coding system
 to use when encoding and decoding system strings such as system error
-messages and @code{format-time-string} formats and time stamps.  You
-should choose a coding system that is compatible with the underlying
-system's text representation, which is normally specified by one of
-the environment variables @env{LC_ALL}, @env{LC_CTYPE}, and
-@env{LANG}.  (The first one, in the order specified above, whose value
-is nonempty is the one that determines the text representation.)
+messages and @code{format-time-string} formats and time stamps.  That
+coding system is also used for decoding non-@acronym{ASCII} keyboard input on X
+Window systems.  You should choose a coding system that is compatible
+with the underlying system's text representation, which is normally
+specified by one of the environment variables @env{LC_ALL},
+@env{LC_CTYPE}, and @env{LANG}.  (The first one, in the order
+specified above, whose value is nonempty is the one that determines
+the text representation.)
 
 @node Fontsets
 @section Fontsets
@@ -1089,7 +1148,7 @@ additional font support.}
 
   Emacs creates two fontsets automatically: the @dfn{standard fontset}
 and the @dfn{startup fontset}.  The standard fontset is most likely to
-have fonts for a wide variety of non-ASCII characters; however, this is
+have fonts for a wide variety of non-@acronym{ASCII} characters; however, this is
 not the default for Emacs to use.  (By default, Emacs tries to find a
 font that has bold and italic variants.)  You can specify use of the
 standard fontset with the @samp{-fn} option, or with the @samp{Font} X
@@ -1125,7 +1184,7 @@ created automatically.  Their names have @samp{bold} instead of
 @samp{medium}, or @samp{i} instead of @samp{r}, or both.
 
 @cindex startup fontset
-  If you specify a default ASCII font with the @samp{Font} resource or
+  If you specify a default @acronym{ASCII} font with the @samp{Font} resource or
 the @samp{-fn} argument, Emacs generates a fontset from it
 automatically.  This is the @dfn{startup fontset} and its name is
 @code{fontset-startup}.  It does this by replacing the @var{foundry},
@@ -1179,7 +1238,7 @@ number of times in defining one fontset.
 
   For the other character sets, Emacs chooses a font based on
 @var{fontpattern}.  It replaces @samp{fontset-@var{alias}} with values
-that describe the character set.  For the ASCII character font,
+that describe the character set.  For the @acronym{ASCII} character font,
 @samp{fontset-@var{alias}} is replaced with @samp{ISO8859-1}.
 
   In addition, when several consecutive fields are wildcards, Emacs
@@ -1196,7 +1255,7 @@ does.
 @end example
 
 @noindent
-the font specification for ASCII characters would be this:
+the font specification for @acronym{ASCII} characters would be this:
 
 @example
 -*-fixed-medium-r-normal-*-24-*-ISO8859-1
@@ -1235,9 +1294,9 @@ call this function explicitly to create a fontset.
 @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-@acronym{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.
@@ -1247,15 +1306,15 @@ you may not have fonts installed for all of them; characters that have
 no font appear as a hollow box.
 
   If you use Latin-1 characters but your terminal can't display
-Latin-1, you can arrange to display mnemonic ASCII sequences
+Latin-1, you can arrange to display mnemonic @acronym{ASCII} sequences
 instead, e.g.@: @samp{"o} for o-umlaut.  Load the library
 @file{iso-ascii} to do this.
 
 @vindex latin1-display
   If your terminal can display Latin-1, you can display characters
 from other European character sets using a mixture of equivalent
-Latin-1 characters and ASCII mnemonics.  Use the Custom option
-@code{latin1-display} to enable this.  The mnemonic ASCII
+Latin-1 characters and @acronym{ASCII} mnemonics.  Customize the variable
+@code{latin1-display} to enable this.  The mnemonic @acronym{ASCII}
 sequences mostly correspond to those of the prefix input methods.
 
 @node Single-Byte Character Support
@@ -1276,7 +1335,7 @@ such as @samp{Latin-@var{n}}.
 
   For more information about unibyte operation, see @ref{Enabling
 Multibyte}.  Note particularly that you probably want to ensure that
-your initialization files are read as unibyte if they contain non-ASCII
+your initialization files are read as unibyte if they contain non-@acronym{ASCII}
 characters.
 
 @vindex unibyte-display-via-language-environment
@@ -1290,7 +1349,7 @@ to a non-@code{nil} value.
 
 @cindex @code{iso-ascii} library
   If your terminal does not support display of the Latin-1 character
-set, Emacs can display these characters as ASCII sequences which at
+set, Emacs can display these characters as @acronym{ASCII} sequences which at
 least give you a clear idea of what the characters are.  To do this,
 load the library @code{iso-ascii}.  Similar libraries for other
 Latin-@var{n} character sets could be implemented, but we don't have
@@ -1303,60 +1362,86 @@ inclusive) are displayed as octal escapes.  You can change this for
 non-standard ``extended'' versions of ISO-8859 character sets by using the
 function @code{standard-display-8bit} in the @code{disp-table} library.
 
-  There are several ways you can input single-byte non-ASCII
+  There are two ways to input single-byte non-@acronym{ASCII}
 characters:
 
 @itemize @bullet
 @cindex 8-bit input
+@item
+You can use an input method for the selected language environment.
+@xref{Input Methods}.  When you use an input method in a unibyte buffer,
+the non-@acronym{ASCII} character you specify with it is converted to unibyte.
+
 @item
 If your keyboard can generate character codes 128 (decimal) and up,
-representing non-ASCII characters, you can type those character codes
+representing non-@acronym{ASCII} characters, you can type those character codes
 directly.
 
-On a windowing terminal, you should not need to do anything special to
-use these keys; they should simply work.  On a text-only terminal, you
+On a window system, you should not need to do anything special to use
+these keys; they should simply work.  On a text-only terminal, you
 should use the command @code{M-x set-keyboard-coding-system} or the
-Custom option @code{keyboard-coding-system} to specify which coding
-system your keyboard uses (@pxref{Specify Coding}).  Enabling this
-feature will probably require you to use @kbd{ESC} to type Meta
-characters; however, on a Linux console or in @code{xterm}, you can
-arrange for Meta to be converted to @kbd{ESC} and still be able type
-8-bit characters present directly on the keyboard or using
-@kbd{Compose} or @kbd{AltGr} keys.  @xref{User Input}.
-
-@item
-You can use an input method for the selected language environment.
-@xref{Input Methods}.  When you use an input method in a unibyte buffer,
-the non-ASCII character you specify with it is converted to unibyte.
+variable @code{keyboard-coding-system} to specify which coding system
+your keyboard uses (@pxref{Specify Coding}).  Enabling this feature
+will probably require you to use @kbd{ESC} to type Meta characters;
+however, on a console terminal or in @code{xterm}, you can arrange for
+Meta to be converted to @kbd{ESC} and still be able type 8-bit
+characters present directly on the keyboard or using @kbd{Compose} or
+@kbd{AltGr} keys.  @xref{User Input}.
 
 @kindex C-x 8
 @cindex @code{iso-transl} library
 @cindex compose character
 @cindex dead character
 @item
-For Latin-1 only, you can use the
-key @kbd{C-x 8} as a ``compose character'' prefix for entry of
-non-ASCII Latin-1 printing characters.  @kbd{C-x 8} is good for
-insertion (in the minibuffer as well as other buffers), for searching,
-and in any other context where a key sequence is allowed.
+For Latin-1 only, you can use the key @kbd{C-x 8} as a ``compose
+character'' prefix for entry of non-@acronym{ASCII} Latin-1 printing
+characters.  @kbd{C-x 8} is good for insertion (in the minibuffer as
+well as other buffers), for searching, and in any other context where
+a key sequence is allowed.
 
 @kbd{C-x 8} works by loading the @code{iso-transl} library.  Once that
-library is loaded, the @key{ALT} modifier key, if you have one, serves
-the same purpose as @kbd{C-x 8}; use @key{ALT} together with an accent
-character to modify the following letter.  In addition, if you have keys
-for the Latin-1 ``dead accent characters,'' they too are defined to
-compose with the following character, once @code{iso-transl} is loaded.
-Use @kbd{C-x 8 C-h} to list the available translations as mnemonic
-command names.
-
-@item
-@cindex @code{iso-acc} library
-@cindex ISO Accents mode
-@findex iso-accents-mode
-@cindex Latin-1, Latin-2 and Latin-3 input mode
-For Latin-1, Latin-2 and Latin-3, @kbd{M-x iso-accents-mode} enables
-a minor mode that works much like the @code{latin-1-prefix} input
-method, but does not depend on having the input methods installed.  This
-mode is buffer-local.  It can be customized for various languages with
-@kbd{M-x iso-accents-customize}.
+library is loaded, the @key{ALT} modifier key, if the keyboard has
+one, serves the same purpose as @kbd{C-x 8}: use @key{ALT} together
+with an accent character to modify the following letter.  In addition,
+if the keyboard has keys for the Latin-1 ``dead accent characters,''
+they too are defined to compose with the following character, once
+@code{iso-transl} is loaded.
+
+Use @kbd{C-x 8 C-h} to list all the available @kbd{C-x 8} translations.
 @end itemize
+
+@node Charsets
+@section Charsets
+@cindex charsets
+
+  Emacs groups all supported characters into disjoint @dfn{charsets}.
+Each character code belongs to one and only one charset.  For
+historical reasons, Emacs typically divides an 8-bit character code
+for an extended version of @acronym{ASCII} into two charsets: @acronym{ASCII}, which
+covers the codes 0 through 127, plus another charset which covers the
+``right-hand part'' (the codes 128 and up).  For instance, the
+characters of Latin-1 include the Emacs charset @code{ascii} plus the
+Emacs charset @code{latin-iso8859-1}.
+
+  Emacs characters belonging to different charsets may look the same,
+but they are still different characters.  For example, the letter
+@samp{o} with acute accent in charset @code{latin-iso8859-1}, used for
+Latin-1, is different from the letter @samp{o} with acute accent in
+charset @code{latin-iso8859-2}, used for Latin-2.
+
+@findex list-charset-chars
+@cindex characters in a certain charset
+@findex describe-character-set
+  There are two commands for obtaining information about Emacs
+charsets.  The command @kbd{M-x list-charset-chars} prompts for a name
+of a character set, and displays all the characters in that character
+set.  The command @kbd{M-x describe-character-set} prompts for a
+charset name and displays information about that charset, including
+its internal representation within Emacs.
+
+  To find out which charset a character in the buffer belongs to,
+put point before it and type @kbd{C-u C-x =}.
+
+@ignore
+   arch-tag: 310ba60d-31ef-4ce7-91f1-f282dd57b6b3
+@end ignore