@c -*-texinfo-*-
@c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+@c Copyright (C) 1998, 1999 Free Software Foundation, Inc.
@c See the file elisp.texi for copying conditions.
@setfilename ../info/characters
@node Non-ASCII Characters, Searching and Matching, Text, Top
@defun string-make-unibyte string
This function converts the text of @var{string} to unibyte
representation, if it isn't already, and returns the result. If
-@var{string} is a unibyte string, it is returned unchanged.
-Multibyte character codes are converted to unibyte
-by using just the low 8 bits.
+@var{string} is a unibyte string, it is returned unchanged. Multibyte
+character codes are converted to unibyte according to
+@code{nonascii-translation-table} or, if that is @code{nil}, using
+@code{nonascii-insert-offset}. If the lookup in the translation table
+fails, this function takes just the low 8 bits of each character.
@end defun
@defun string-make-multibyte string
@defvar buffer-file-coding-system
This variable records the coding system that was used for visiting the
current buffer. It is used for saving the buffer, and for writing part
-of the buffer with @code{write-region}. When those operations ask the
-user to specify a different coding system,
-@code{buffer-file-coding-system} is updated to the coding system
-specified.
-
-However, @code{buffer-file-coding-system} does not affect sending text
+of the buffer with @code{write-region}. If the text to be written
+cannot be safely encoded using the coding system specified by this
+variable, these operations select an alternative encoding by calling
+the function @code{select-safe-coding-system} (@pxref{User-Chosen
+Coding Systems}). If selecting a different encoding requires to ask
+the user to specify a coding system, @code{buffer-file-coding-system}
+is updated to the newly selected coding system.
+
+@code{buffer-file-coding-system} does @emph{not} affect sending text
to a subprocess.
@end defvar
@code{buffer-file-coding-system} (or @code{save-buffer-coding-system}),
and that coding system cannot handle
the actual text in the buffer, the command asks the user to choose
-another coding system. After that happens, the command also updates
-@code{buffer-file-coding-system} to represent the coding system that the
-user specified.
+another coding system (by calling @code{select-safe-coding-system}).
+After that happens, the command also updates
+@code{buffer-file-coding-system} to represent the coding system that
+the user specified.
@end defvar
@defvar last-coding-system-used
@node User-Chosen Coding Systems
@subsection User-Chosen Coding Systems
+@cindex select safe coding system
@defun select-safe-coding-system from to &optional default-coding-system accept-default-p
This function selects a coding system for encoding specified text,
asking the user to choose if necessary. Normally the specified text
is the text in the current buffer between @var{from} and @var{to},
defaulting to the whole buffer if they are @code{nil}. If @var{from}
-is a string, the string is the specified text, and @var{to} is ignored.
+is a string, the string specifies the text to encode, and @var{to} is
+ignored.
If @var{default-coding-system} is non-@code{nil}, that is the first
coding system to try; if that can handle the text,
@defvar locale-coding-system
@tindex locale-coding-system
+@cindex keyboard input decoding on X
This variable specifies the coding system to use for decoding system
-error messages, for encoding the format argument to
-@code{format-time-string}, and for decoding the return value of
-@code{format-time-string}.
+error messages and---on X Window system only---keyboard input, for
+encoding the format argument to @code{format-time-string}, and for
+decoding the return value of @code{format-time-string}.
@end defvar
@defvar system-messages-locale