warn against localization issues

2004-12-26  Paolo Bonzini  <bonzini@gnu.org>

	* BUGS: Add section about [a-z] matching uppercase characters,
	and other locale issues.
	* doc/sed-in.texi [!PERL]: Likewise.

git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-31
This commit is contained in:
Paolo Bonzini committed 2008-01-09 16:11:39 +01:00
1 parent 65048613e4
commit bc7f50307a
3 files changed
+49 -3

No files matched your search

+18
View File
@@ -101,3 +101,21 @@ regex syntax clashes (problems with backslashes)
to delete every line up to the first one including `abc', and this
is obtained with `0,/abc/d'.
`[a-z]' is case insensitive
You are encountering problems with locales. POSIX mandates that `[a-z]'
uses the current locale's collation order -- in C parlance, that means
strcoll(3) instead of strcmp(3). Some locales have a case insensitive
strcoll, others don't: one of those that have problems is Estonian.
Another problem is that [a-z] tries to use collation symbols. This
only happens if you are on the GNU system, using GNU libc's regular
expression matcher instead of compiling the one supplied with GNU sed.
In a Danish locale, for example, the regular expression `^[a-z]$'
matches the string `aa', because aa is a single collating symbol that
comes after `a' and before `b'; `ll' behaves similarly in Spanish
locales, or `ij' in Dutch locales.
To work around these problems, which may cause bugs in shell scripts,
set the LC_COLLATE and LC_CTYPE environment variables to `C'.
+6
View File
@@ -1,3 +1,9 @@
2004-12-26 Paolo Bonzini <bonzini@gnu.org>
* BUGS: Add section about [a-z] matching uppercase characters,
and other locale issues.
* doc/sed-in.texi [!PERL]: Likewise.
2004-11-15 Paolo Bonzini <bonzini@gnu.org>
* sed/execute.c (str_append_modified): Copy the first character
+25 -3
View File
@@ -2707,14 +2707,36 @@ bug@dots{}).
@item @code{0a} does not work (gives an error)
There is no line 0. 0 is a special address that is only used to treat
addresses like @samp{0,/@var{RE}/} as active when the script starts: if
you write @samp{1,/abc/d} and the first line includes the word @samp{abc},
addresses like @code{0,/@var{RE}/} as active when the script starts: if
you write @code{1,/abc/d} and the first line includes the word @samp{abc},
then that match would be ignored because address ranges must span at least
two lines (barring the end of the file); but what you probably wanted is
to delete every line up to the first one including @samp{abc}, and this
is obtained with @samp{0,/abc/d}.
is obtained with @code{0,/abc/d}.
@ifclear PERL
@item @code{[a-z]} is case insensitive
You are encountering problems with locales. POSIX mandates that @code{[a-z]}
uses the current locale's collation order -- in C parlance, that means using
@code{strcoll(3)} instead of @code{strcmp(3)}. Some locales have a
case-insensitive collation order, others don't: one of those that have
problems is Estonian.
Another problem is that @code{[a-z]} tries to use collation symbols.
This only happens if you are on the @acronym{GNU} system, using
@acronym{GNU} libc's regular expression matcher instead of compiling the
one supplied with @acronym{GNU} sed. In a Danish locale, for example,
the regular expression @code{^[a-z]$} matches the string @samp{aa},
because this is a single collating symbol that comes after @samp{a}
and before @samp{b}; @samp{ll} behaves similarly in Spanish
locales, or @samp{ij} in Dutch locales.
To work around these problems, which may cause bugs in shell scripts, set
the @env{LC_COLLATE} and @env{LC_CTYPE} environment variables to @samp{C}.
@end ifclear
@end table
@node Extended regexps
@appendix Extended regular expressions
@cindex Extended regular expressions, syntax