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


On May 25 11:28, KOBAYASHI Shinji wrote:
> 
> Any other comments on this topic? Let me explain my proposal again.
> 
> The intention of the following code in tzsetwall() should be to pick
> up UPPERCASE letters "in ASCII range":
> 
> if (isupper(*src)) *dst++ = *src;
> 
> NOTE: src is wchar_t *, dst is char *.
> 
> As Csaba Raduly pointed out, isw*() functions should be the first
> choice if they achieve the desired behavior (select uppercase AND
> ASCII). However, iswupper() does not fit for this purpose, as it
> returns 1 for L'\uff21' for example. And I could not find isw*()

In that case, wouldn't it make sense to fix iswupper in the first place?
It relies on the towupper function in newlib/libc/ctype/towlower.c.

However, I don't understand the example.  0xff21 is FULLWIDTH LATIN
CAPITAL LETTER A.  This is very certainly an uppercase letter so
towlower transforms it to 0xff41, FULLWIDTH LATIN SMALL LETTER A.

However, testing this with GLibc it turns out that GLibc's towlower does not
transform the character but returns 0xff21.  Can anybody explain to me why?  

Apart from that, we can workaround all problems in tzsetwall by just
checking for 

  if (*src >= L'A' && *src <= L'Z')

So, yeah, I can do the above change to tzsetwall and it would be nice if
somebody could take a critical look over newlib's towlower.c and
toupper.c.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature


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