bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MirBSD mbtowc bug? failure on test-wcrtomb


From: Bruno Haible
Subject: Re: MirBSD mbtowc bug? failure on test-wcrtomb
Date: Sun, 24 Oct 2010 01:59:26 +0200
User-agent: KMail/1.9.9

Thorsten Glaser wrote:
> setlocale() is a nop and thus never has side effects.
> 
> If an application wants to use iso-8859-1, it can do that, because the
> encoding of the system is OPTU-8:
> 
> möp (latin1) = 0x6D 0xF6 0x70
> ↓ convert to wchar_t ↓
> 0x006D 0xEFF6 0x0070
> ↓ convert to char ↓
> 0x6D 0xF6 0x70

This cannot work in the way users expect.

1) The conversion from ISO-8859-1 to wchar_t may misinterpret some sequences
   of characters (namely those that happen to look like valid UTF-8,
   such as 0x31 0xD7 0xBD ("1×½").

2) The <ctype.h> and <wctype.h> functions cannot work. For example, in
   ISO-8859-1 encoding, toupper(0xF6) = 0xD6. Whereas in ISO-8859-5,
   toupper(0xF6) = 0xA6. You cannot have both in the same locale.

In summary, your system does NOT support ISO-8859-* locales, and therefore
a minimally POSIX compliant setlocale() function ought to return NULL when
asked to set such a locale.

Bruno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]