This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Invalid tm_zone from localtime() when TZ is not set


>>>>>	Csaba Raduly wrote:
> If the type of those members is WCHAR[] then using isascii() /
> isupper() on them is just plain wrong.
> The correct function to use would be iswupper().

I agree that isw*() functions should be used for wchar_t. But I think
just changing isupper() to iswupper() is not enough as I explain
below. If iswascii() was available, using both iswascii() and
iswupper() might be a candidate.

> The line
>     if (isupper(*src)) *dst++ = *src;
> (where src is wchar_t* and dst is char*) assumes that the upper 8 bits
> of *src are zero (or *src is -1).
> If not, the behavior is at best implementation-defined (maybe even undefined).

With Japanese Windows, the upper 8 bits of *src are not zero. So I
would like to correct the behavior. I think adding isascii() can be a

>> 1. Using iswupper() instead of isupper().
>>    - Although this method is effective for Japanese environments, it
>>      is not assured that the character iswupper() returns true fits in
>>      the range of ASCII.
> It is highly likely that if the argument of iswupper() does not fit
> into ASCII then its result won't fit either.

I'm not sure if I understand what you are saying, but for example
iswupper(L'\uff21') returns 1 in Japanese locale.



Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]