Re: wctomb() accepts out-of-range character in C-locale

Steven J Abner <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>

> On Tue, Mar 26 2024 at 01:43:57 AM +0000, Jun. T 
> <[email protected]> wrote:
>> I think POSIX doesn't say anything about the 8bit part of
>> the C-locale; it just says it can be implementation dependent.
>> 
>> It is newlib that choses the implementation in which chars
>> in 0x80-0xff in C-locale correspond to those chars with
>> the same wide-char values (virtually equivalent to latin1).
>> 
>> Other system may chose other implementation, I think.
> 
The 'C' locale of old did have only 128 codes. These codes represented 
the
referred to 'portable character set', which you refer to as ascii. Then
POSIX redefined the 'C' locale and I quote:
"Conforming systems shall provide a POSIX locale, also known as the C 
locale.".
POSIX also states that these codes: "The POSIX locale shall contain 256 
single-byte
characters including the characters in Portable Character Set and 
Non-Portable Control Characters".
The character codes 0x80-0xFF are not really implementation defined. 
They are classified
as 'cntl' codes, thou not officially stated, and valid codes. This 
makes POSIX locale
as portable as the old 'C' locale.
The 'implementation' defined you seem to be referring to is the 
defining of
character map encodings for other locales. Then 0x80-0xFF take on 
meanings other
then the 'C', POSIX locale, but are still defined by a standard listed 
by IANA of
defined character maps.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.