[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: builtin printf behaves incorrectly with "c and 'c character-value ar
From: |
Chet Ramey |
Subject: |
Re: builtin printf behaves incorrectly with "c and 'c character-value arguments |
Date: |
Mon, 05 Nov 2007 22:23:43 -0500 |
User-agent: |
Thunderbird 2.0.0.6 (Macintosh/20070728) |
Rich Felker wrote:
> I'm not sure what you mean. For a Latin-1 locale there is no
> difference, but if the locale is a different legacy locale, the
> wchar_t value (Unicode scalar value on systems with __STDC_ISO_10646__
> defined) needs to be returned. If you're doubtful about the intent of
> the standard, why not file a request for interpretation?
I'm not doubtful about the standard's intent. When the user has not
chosen to use a locale that contains multibyte characters, not only
should bash not second-guess the user by returning a multibyte
character, functions such as mbrtowc or mblen/mbrlen will not return
"multibyte" values (e.g., mbrlen will return `1' and mbrtowc will return
`-61' -- converted to 195, since it's unsigned -- as its wchar value
while converting 1 character in your example).
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong. No day but today.
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/