comparison lispref/nonascii.texi @ 51990:3e55792cc7f1

(Converting Representations): Add string-to-multibyte. (Translation of Characters): Add translation-table-for-input. (Default Coding Systems): Add auto-coding-functions. (Explicit Encoding): Add decode-coding-inserted-region. (Locales): Add locale-info.
author Richard M. Stallman <rms@gnu.org>
date Tue, 22 Jul 2003 15:15:20 +0000
parents b8860fc285cb
children 695cf19ef79e
comparison
equal deleted inserted replaced
51989:13ba58726a52 51990:3e55792cc7f1
189 @var{string} is a multibyte string, it is returned unchanged. 189 @var{string} is a multibyte string, it is returned unchanged.
190 The function @code{unibyte-char-to-multibyte} is used to convert 190 The function @code{unibyte-char-to-multibyte} is used to convert
191 each unibyte character to a multibyte character. 191 each unibyte character to a multibyte character.
192 @end defun 192 @end defun
193 193
194 @defun string-to-multibyte string
195 This function returns a multibyte string containing the same sequence
196 of character codes as @var{string}. If @var{string} is a multibyte
197 string, the value is the equal to @var{string}.
198 @end defun
199
194 @node Selecting a Representation 200 @node Selecting a Representation
195 @section Selecting a Representation 201 @section Selecting a Representation
196 202
197 Sometimes it is useful to examine an existing buffer or string as 203 Sometimes it is useful to examine an existing buffer or string as
198 multibyte when it was unibyte, or vice versa. 204 multibyte when it was unibyte, or vice versa.
501 @end defvar 507 @end defvar
502 508
503 @defvar standard-translation-table-for-encode 509 @defvar standard-translation-table-for-encode
504 This is the default translation table for encoding, for 510 This is the default translation table for encoding, for
505 coding systems that don't specify any other translation table. 511 coding systems that don't specify any other translation table.
512 @end defvar
513
514 @defvar translation-table-for-input
515 Self-inserting characters are translated through this translation
516 table before they are inserted.
506 @end defvar 517 @end defvar
507 518
508 @node Coding Systems 519 @node Coding Systems
509 @section Coding Systems 520 @section Coding Systems
510 521
885 The value should be a cons cell of the form @code{(@var{input-coding} 896 The value should be a cons cell of the form @code{(@var{input-coding}
886 . @var{output-coding})}. Here @var{input-coding} applies to input from 897 . @var{output-coding})}. Here @var{input-coding} applies to input from
887 the subprocess, and @var{output-coding} applies to output to it. 898 the subprocess, and @var{output-coding} applies to output to it.
888 @end defvar 899 @end defvar
889 900
901 @defvar auto-coding-functions
902 This variable holds a list of functions that try to determine a
903 coding system for a file based on its undecoded contents.
904
905 Each function in this list should be written to look at text in the
906 current buffer, but should not modify it in any way. The buffer will
907 contain undecoded text of parts of the file. Each function should
908 take one argument, @var{size}, which tells it how many characters to
909 look at, starting from point. If the function succeeds in determining
910 a coding system for the file, it should return that coding system.
911 Otherwise, it should return @code{nil}.
912
913 If a file has a @samp{coding:} tag, that takes precedence, so these
914 functions won't be called.
915 @end defvar
916
890 @defun find-operation-coding-system operation &rest arguments 917 @defun find-operation-coding-system operation &rest arguments
891 This function returns the coding system to use (by default) for 918 This function returns the coding system to use (by default) for
892 performing @var{operation} with @var{arguments}. The value has this 919 performing @var{operation} with @var{arguments}. The value has this
893 form: 920 form:
894 921
1036 This function decodes the text in @var{string} according to coding 1063 This function decodes the text in @var{string} according to coding
1037 system @var{coding-system}. It returns a new string containing the 1064 system @var{coding-system}. It returns a new string containing the
1038 decoded text. To make explicit decoding useful, the contents of 1065 decoded text. To make explicit decoding useful, the contents of
1039 @var{string} ought to be a sequence of byte values, but a multibyte 1066 @var{string} ought to be a sequence of byte values, but a multibyte
1040 string is acceptable. 1067 string is acceptable.
1068 @end defun
1069
1070 @defun decode-coding-inserted-region from to filename &optional visit beg end replace
1071 This function decodes the text from @var{from} to @var{to} as if
1072 it were being read from file @var{filename} using @code{insert-file-contents}
1073 using the rest of the arguments provided.
1074
1075 The normal way to use this function is after reading text from a file
1076 without decoding, if you decide you would rather have decoded it.
1077 Instead of deleting the text and reading it again, this time with
1078 decoding, you can call this function.
1041 @end defun 1079 @end defun
1042 1080
1043 @node Terminal I/O Encoding 1081 @node Terminal I/O Encoding
1044 @subsection Terminal I/O Encoding 1082 @subsection Terminal I/O Encoding
1045 1083
1233 Changing the locale can cause messages to appear according to the 1271 Changing the locale can cause messages to appear according to the
1234 conventions of a different language. If the variable is @code{nil}, the 1272 conventions of a different language. If the variable is @code{nil}, the
1235 locale is specified by environment variables in the usual POSIX fashion. 1273 locale is specified by environment variables in the usual POSIX fashion.
1236 @end defvar 1274 @end defvar
1237 1275
1276 @defun locale-info item
1277 This function returns locale data @var{item} for the current POSIX
1278 locale, if available. @var{item} should be one of these symbols:
1279
1280 @table @code
1281 @item codeset
1282 Return the character set as a string (locale item @code{CODESET}).
1283
1284 @item days
1285 Return a 7-element vector of day names (locale items
1286 @code{DAY_1} through @code{DAY_7});
1287
1288 @item months
1289 Return a 12-element vector of month names (locale items @code{MON_1}
1290 through @code{MON_12}).
1291
1292 @item paper
1293 Return a list @code{(@var{width} @var{height})} for the default paper
1294 size measured in milimeters (locale items @code{PAPER_WIDTH} and
1295 @code{PAPER_HEIGHT}).
1296 @end table
1297
1298 If the system can't provide the requested information, or if
1299 @var{item} is not one of those symbols, the value is @code{nil}. All
1300 strings in the return value are decoded using
1301 @code{locale-coding-system}. @xref{Locales,,, libc, GNU Libc Manual},
1302 for more information about locales and locale items.
1303 @end defun