From: Bruno Haible Date: Mon, 19 Jun 2023 17:23:51 +0000 (+0200) Subject: doc: Corrections to the "Strings and Characters" chapter. X-Git-Tag: v1.0~1203 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=6b62809fc99089c93cee2cfff8af7fe19008900a;p=gnulib.git doc: Corrections to the "Strings and Characters" chapter. Suggested by Paul Eggert. * doc/strings.texi: Corrections: GB18030 is rarely used nowadays. functions can be useful for specific data. --- diff --git a/ChangeLog b/ChangeLog index 243a1c859f..d3e4efcf28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-06-19 Bruno Haible + + doc: Corrections to the "Strings and Characters" chapter. + Suggested by Paul Eggert. + * doc/strings.texi: Corrections: GB18030 is rarely used nowadays. + functions can be useful for specific data. + 2023-06-19 Bruno Haible doc: Use "spaced en dash" style instead of "spaced em dash" style. diff --git a/doc/strings.texi b/doc/strings.texi index 131221f583..cbed6533c4 100644 --- a/doc/strings.texi +++ b/doc/strings.texi @@ -76,7 +76,7 @@ When every character is represented by only 1 byte, we speak of an ``unibyte locale'', otherwise of a ``multibyte locale''. It is important to realize that the majority of Unix installations -nowadays use UTF-8 or GB18030 as locale encoding; therefore, the +nowadays use UTF-8 as locale encoding; therefore, the majority of users are using multibyte locales. Three important facts to remember are: @@ -89,8 +89,8 @@ As a consequence: @itemize @bullet @item The @posixheader{ctype.h} API, that was designed only with unibyte -encodings in mind, is useless nowadays; it does not work in -multibyte locales. +encodings in mind, is useless nowadays for general text processing; it +does not work in multibyte locales. @item The @posixfunc{strlen} function does not return the number of characters in a string. Nor does it return the number of screen columns occupied @@ -107,9 +107,9 @@ represented by a hollow box. @emph{Multibyte does not imply UTF-8 encoding.} @end cartouche -While UTF-8 is the most common multibyte encoding, GB18030 is there as -well and will not go away within decades, because it is a Chinese -government standard, last revised in 2022. +While UTF-8 is the most common multibyte encoding, GB18030 is also a +supported locale encoding on GNU systems (mostly because it is a Chinese +government standard, last revised in 2022). @cartouche @emph{Searching for a character in a string is not the same as searching @@ -184,7 +184,7 @@ Gnulib also has additional API. @node Iterating through strings @subsubsection Iterating through strings -For complex string processing, the provided strings functions may not be +For complex string processing, the provided string functions may not be enough, and what you need is a way to iterate through a string while processing each (possibly multibyte) character in turn. Gnulib provides two modules for this purpose. Both iterate through the string in @@ -604,7 +604,8 @@ locales nowadays are multibyte locales, it makes no sense to write a program that runs only in unibyte locales. ISO C and POSIX standardized an API for characters of type @code{char}, -in @code{}. This API is nowadays useless and obsolete. +in @code{}. This API is nowadays useless and obsolete, when it +comes to general text processing. The important lessons to remember are: