]> code.delx.au - gnu-emacs/blobdiff - man/mule.texi
Do not assume DST starts/ends on the same date in every year.
[gnu-emacs] / man / mule.texi
index 86f7bec0b9bc9890e1b36cfecd8ad89c9ddb7e00..9437e30f485a045089f0b1c9aa34a76cbf10c3a3 100644 (file)
@@ -1,6 +1,6 @@
 @c This is part of the Emacs manual.
 @c Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004,
-@c   2005 Free Software Foundation, Inc.
+@c   2005, 2006 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node International, Major Modes, Frames, Top
 @chapter International Character Set Support
@@ -72,8 +72,7 @@ your language environment.  If
 your keyboard can produce non-@acronym{ASCII} characters, you can select an
 appropriate keyboard coding system (@pxref{Terminal 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}.
+using the @kbd{C-x 8} prefix, see @ref{Unibyte Mode}.
 
 On X Window systems, your locale should be set to an appropriate value
 to make sure Emacs interprets keyboard input correctly; see
@@ -92,6 +91,8 @@ to make sure Emacs interprets keyboard input correctly; see
 * Coding Systems::          Character set conversion when you read and
                               write files, and so on.
 * Recognize Coding::        How Emacs figures out which conversion to use.
+* Specify Coding::          Specifying a file's coding system explicitly.
+* Output Coding::           Choosing coding systems for output.
 * Text Coding::             Choosing conversion to use for file text.
 * Communication Coding::    Coding systems for interprocess communication.
 * File Name Coding::        Coding systems for file @emph{names}.
@@ -101,7 +102,7 @@ to make sure Emacs interprets keyboard input correctly; see
                               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
+* Unibyte Mode::            You can pick one European character set
                               to use without multibyte characters.
 * Charsets::                How Emacs groups its internal character codes.
 @end menu
@@ -430,9 +431,9 @@ immediately delete it.  For example, you could type @kbd{e e @key{DEL}
   Another method, more general but not quite as easy to type, is to use
 @kbd{C-\ C-\} between two characters to stop them from combining.  This
 is the command @kbd{C-\} (@code{toggle-input-method}) used twice.
-@ifinfo
+@ifnottex
 @xref{Select Input Method}.
-@end ifinfo
+@end ifnottex
 
 @cindex incremental search, input method interference
   @kbd{C-\ C-\} is especially useful inside an incremental search,
@@ -544,7 +545,7 @@ 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
+  To see 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.
 
@@ -564,9 +565,9 @@ through your choice of language environment
 @iftex
 (see above).
 @end iftex
-@ifinfo
+@ifnottex
 (@pxref{Language Environments}).
-@end ifinfo
+@end ifnottex
 If you do not specify a choice, the default is Latin-1.
 
   If you insert a character in the range 0200 through 0237, which
@@ -606,7 +607,13 @@ system; for example, to visit a file encoded in codepage 850, type
 @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}.}.
+@iftex
+@xref{MS-DOS and MULE,,,emacs-extra,Specialized Emacs Features}.
+@end iftex
+@ifnottex
+@xref{MS-DOS and MULE}.
+@end ifnottex
+}.
 
   In addition to converting various representations of non-@acronym{ASCII}
 characters, a coding system can perform end-of-line conversion.  Emacs
@@ -627,7 +634,8 @@ Display a list of all the supported coding systems.
 @kindex C-h C
 @findex describe-coding-system
   The command @kbd{C-h C} (@code{describe-coding-system}) displays
-information about particular coding systems.  You can specify a coding
+information about particular coding systems, including the end-of-line
+conversion specified by those coding systems.  You can specify a coding
 system name as the 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
@@ -640,6 +648,7 @@ system, including the letter that stands for it in the mode line
 (@pxref{Mode Line}).
 
 @cindex end-of-line conversion
+@cindex line endings
 @cindex MS-DOS end-of-line conversion
 @cindex Macintosh end-of-line conversion
   Each of the coding systems that appear in this list---except for
@@ -678,6 +687,13 @@ predictable.  For example, the coding system @code{iso-latin-1} has
 variants @code{iso-latin-1-unix}, @code{iso-latin-1-dos} and
 @code{iso-latin-1-mac}.
 
+@cindex @code{undecided}, coding system
+  The coding systems @code{unix}, @code{dos}, and @code{mac} are
+aliases for @code{undecided-unix}, @code{undecided-dos}, and
+@code{undecided-mac}, respectively.  These coding systems specify only
+the end-of-line conversion, and leave the character code conversion to
+be deduced from the text itself.
+
   The coding system @code{raw-text} is good for a file which is mainly
 @acronym{ASCII} text, but may contain byte values above 127 which are
 not meant to encode non-@acronym{ASCII} characters.  With
@@ -704,6 +720,24 @@ 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.
 
+@findex unify-8859-on-decoding-mode
+@anchor{Character Translation} 
+  The @dfn{character translation} feature can modify the effect of
+various coding systems, by changing the internal Emacs codes that
+decoding produces.  For instance, 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 enable-character-translation
+  If you set the variable @code{enable-character-translation} to
+@code{nil}, that disables all character translation (including
+@code{unify-8859-on-decoding-mode}).
+
 @node Recognize Coding
 @section Recognizing Coding Systems
 
@@ -751,7 +785,7 @@ file.  The variable @code{file-coding-system-alist} specifies this
 correspondence.  There is a special function
 @code{modify-coding-system-alist} for adding elements to this list.  For
 example, to read and write all @samp{.txt} files using the coding system
-@code{china-iso-8bit}, you can execute this Lisp expression:
+@code{chinese-iso-8bit}, you can execute this Lisp expression:
 
 @smallexample
 (modify-coding-system-alist 'file "\\.txt\\'" 'chinese-iso-8bit)
@@ -798,18 +832,6 @@ 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.
 
-@vindex coding
-  You can specify the coding system for a particular file using the
-@w{@samp{-*-@dots{}-*-}} construct at the beginning of a file, or a
-local variables list at the end (@pxref{File Variables}).  You do this
-by defining a value for the ``variable'' named @code{coding}.  Emacs
-does not really have a variable @code{coding}; instead of setting a
-variable, this uses the specified coding system for the file.  For
-example, @samp{-*-mode: C; coding: latin-1;-*-} specifies use of the
-Latin-1 coding system, as well as C mode.  When you specify the coding
-explicitly in the file, that overrides
-@code{file-coding-system-alist}.
-
 @vindex auto-coding-alist
 @vindex auto-coding-regexp-alist
 @vindex auto-coding-functions
@@ -826,6 +848,24 @@ 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.
 
+@vindex rmail-decode-mime-charset
+  When you get new mail in Rmail, each message is translated
+automatically from the coding system it is written in, as if it were a
+separate file.  This uses the priority list of coding systems that you
+have specified.  If a MIME message specifies a character set, Rmail
+obeys that specification, unless @code{rmail-decode-mime-charset} is
+@code{nil}.
+
+@vindex rmail-file-coding-system
+  For reading and saving Rmail files themselves, Emacs uses the coding
+system specified by the variable @code{rmail-file-coding-system}.  The
+default value is @code{nil}, which means that Rmail files are not
+translated (they are read and written in the Emacs internal character
+code).
+
+@node Specify Coding
+@section Specifying a File's Coding System
+
   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} r @var{coding-system} @key{RET}}.  To see what coding system
@@ -833,33 +873,44 @@ 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 coding
+  You can specify the coding system for a particular file in the file
+itself, using the @w{@samp{-*-@dots{}-*-}} construct at the beginning,
+or a local variables list at the end (@pxref{File Variables}).  You do
+this by defining a value for the ``variable'' named @code{coding}.
+Emacs does not really have a variable @code{coding}; instead of
+setting a variable, this uses the specified coding system for the
+file.  For example, @samp{-*-mode: C; coding: latin-1;-*-} specifies
+use of the Latin-1 coding system, as well as C mode.  When you specify
+the coding explicitly in the file, that overrides
+@code{file-coding-system-alist}.
+
+  If you add the character @samp{!} at the end of the coding system
+name in @code{coding}, it disables any character translation
+(@pxref{Character Translation}) while decoding the file.  This is
+useful when you need to make sure that the character codes in the
+Emacs buffer will not vary due to changes in user settings; for
+instance, for the sake of strings in Emacs Lisp source files.
+
+@node Output Coding
+@section Choosing Coding Systems for Output
 
 @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
-system, by default, for operations that write from this buffer into a
-file.  This includes the commands @code{save-buffer} and
-@code{write-region}.  If you want to write files from this buffer using
-a different coding system, you can specify a different coding system for
-the buffer using @code{set-buffer-file-coding-system} (@pxref{Text
-Coding}).
-
-  You can insert any possible character into any Emacs buffer, but
-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 @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
+coding system in @code{buffer-file-coding-system}.  That makes it the
+default for operations that write from this buffer into a file, such
+as @code{save-buffer} and @code{write-region}.  You can specify a
+different coding system for further file output from the buffer using
+@code{set-buffer-file-coding-system} (@pxref{Text Coding}).
+
+  You can insert any character Emacs supports into any Emacs buffer,
+but most coding systems can only handle a subset of these characters.
+Therefore, you can 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 @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
+that buffer, Emacs cannot use the current value of
 @code{buffer-file-coding-system}, because the characters you added
 cannot be encoded by that coding system.
 
@@ -874,12 +925,12 @@ contents, and asks you to choose one of those coding systems.
   If you insert the unsuitable characters in a mail message, Emacs
 behaves a bit differently.  It additionally checks whether the
 most-preferred coding system is recommended for use in MIME messages;
-if not, Emacs tells you that the most-preferred coding system is
-not recommended and prompts you for another coding system.  This is so
-you won't inadvertently send a message encoded in a way that your
-recipient's mail software will have difficulty decoding.  (If you do
-want to use the most-preferred coding system, you can still type its
-name in response to the question.)
+if not, Emacs tells you that the most-preferred coding system is not
+recommended and prompts you for another coding system.  This is so you
+won't inadvertently send a message encoded in a way that your
+recipient's mail software will have difficulty decoding.  (You can
+still use an unsuitable coding system if you type its name in response
+to the question.)
 
 @vindex sendmail-coding-system
   When you send a message with Mail mode (@pxref{Sending Mail}), Emacs has
@@ -892,21 +943,6 @@ new files, which is controlled by your choice of language environment,
 if that is non-@code{nil}.  If all of these three values are @code{nil},
 Emacs encodes outgoing mail using the Latin-1 coding system.
 
-@vindex rmail-decode-mime-charset
-  When you get new mail in Rmail, each message is translated
-automatically from the coding system it is written in, as if it were a
-separate file.  This uses the priority list of coding systems that you
-have specified.  If a MIME message specifies a character set, Rmail
-obeys that specification, unless @code{rmail-decode-mime-charset} is
-@code{nil}.
-
-@vindex rmail-file-coding-system
-  For reading and saving Rmail files themselves, Emacs uses the coding
-system specified by the variable @code{rmail-file-coding-system}.  The
-default value is @code{nil}, which means that Rmail files are not
-translated (they are read and written in the Emacs internal character
-code).
-
 @node Text Coding
 @section Specifying a Coding System for File Text
 
@@ -942,6 +978,13 @@ that cannot handle all of the characters in the buffer, Emacs warns
 you about the troublesome characters when you actually save the
 buffer.
 
+@cindex specify end-of-line conversion
+  You can also use this command to specify the end-of-line conversion
+(@pxref{Coding Systems, end-of-line conversion}) for encoding the
+current buffer.  For example, @kbd{C-x @key{RET} f dos @key{RET}} will
+cause Emacs to save the current buffer's text with DOS-style CRLF line
+endings.
+
 @kindex C-x RET c
 @findex universal-coding-system-argument
   Another way to specify the coding system for a file is when you visit
@@ -960,7 +1003,7 @@ of with @kbd{C-x @key{RET} f}, there is no warning if the buffer
 contains characters that the coding system cannot handle.
 
   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
+@kbd{C-x 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}).  If the
 immediately following command does not use the coding system, then
@@ -1000,11 +1043,11 @@ in communication with other processes.
 @table @kbd
 @item C-x @key{RET} x @var{coding} @key{RET}
 Use coding system @var{coding} for transferring selections to and from
-other programs through the window system.
+other window-based applications.
 
 @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.
+selection---the next one---to or from another window-based application.
 
 @item C-x @key{RET} p @var{input-coding} @key{RET} @var{output-coding} @key{RET}
 Use coding systems @var{input-coding} and @var{output-coding} for
@@ -1166,34 +1209,39 @@ non-graphic characters.
 @section Fontsets
 @cindex fontsets
 
-  A font for X Windows typically defines shapes for a single alphabet
-or script.  Therefore, displaying the entire range of scripts that
-Emacs supports requires a collection of many fonts.  In Emacs, such a
-collection is called a @dfn{fontset}.  A fontset is defined by a list
-of fonts, each assigned to handle a range of character codes.
-
-  Each fontset has a name, like a font.  The available X fonts are
-defined by the X server; fontsets, however, are defined within Emacs
-itself.  Once you have defined a fontset, you can use it within Emacs by
-specifying its name, anywhere that you could use a single font.  Of
-course, Emacs fontsets can use only the fonts that the X server
-supports; if certain characters appear on the screen as hollow boxes,
-this means that the fontset in use for them has no font for those
-characters.@footnote{The Emacs installation instructions have information on
-additional font support.}
+  A font typically defines shapes for a single alphabet or script.
+Therefore, displaying the entire range of scripts that Emacs supports
+requires a collection of many fonts.  In Emacs, such a collection is
+called a @dfn{fontset}.  A fontset is defined by a list of fonts, each
+assigned to handle a range of character codes.
+
+  Each fontset has a name, like a font.  However, while fonts are
+stored in the system and the available font names are defined by the
+system, fontsets are defined within Emacs itself.  Once you have
+defined a fontset, you can use it within Emacs by specifying its name,
+anywhere that you could use a single font.  Of course, Emacs fontsets
+can use only the fonts that the system supports; if certain characters
+appear on the screen as hollow boxes, this means that the fontset in
+use for them has no font for those characters.@footnote{The Emacs
+installation instructions have information on 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-@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} optionor
-with the @samp{Font} X resource (@pxref{Font X}).  For example,
+specify use of the standard fontset with the @samp{-fn} option.  For
+example,
 
 @example
 emacs -fn fontset-standard
 @end example
 
+@noindent
+You can also specify a fontset with the @samp{Font} resource (@pxref{X
+Resources}).
+
   A fontset does not necessarily specify a font for every character
 code.  If a fontset specifies no font for a certain character, or if it
 specifies a font that does not exist on your system, then it cannot
@@ -1353,8 +1401,8 @@ 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
-@section Single-byte Character Set Support
+@node Unibyte Mode
+@section Unibyte Editing Mode
 
 @cindex European character sets
 @cindex accented characters
@@ -1376,8 +1424,8 @@ non-@acronym{ASCII} characters.
 
 @vindex unibyte-display-via-language-environment
   Emacs can also display those characters, provided the terminal or font
-in use supports them.  This works automatically.  Alternatively, if you
-are using a window system, Emacs can also display single-byte characters
+in use supports them.  This works automatically.  Alternatively, on a
+graphical display, Emacs can also display single-byte characters
 through fontsets, in effect by displaying the equivalent multibyte
 characters according to the current language environment.  To request
 this, set the variable @code{unibyte-display-via-language-environment}