This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Invalid tm_zone from localtime() when TZ is not set
- From: KOBAYASHI Shinji <koba at jp dot fujitsu dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 26 May 2016 15:54:00 +0900
- Subject: Re: Invalid tm_zone from localtime() when TZ is not set
- Authentication-results: sourceware.org; auth=none
- References: <o8xeg8x7e2r dot wl-koba at jp dot fujitsu dot com> <932D033F-9DA4-4901-9158-328AA929FEC8 at etr-usa dot com> <o8x8tz573zs dot wl-koba at jp dot fujitsu dot com> <CAEhDDbA-ATpAtVggR7cfqn58AHw0sPK_Y3mNSJ8UO29sg2ZpuA at mail dot gmail dot com> <o8x37pd6nlm dot wl-koba at jp dot fujitsu dot com> <o8xposa6fcl dot wl-koba at jp dot fujitsu dot com> <20160525084430 dot GA17601 at calimero dot vinschen dot de> <2eddaaf6-4e37-cd9b-aa9d-8a87234d0cf9 at t-online dot de>
On Wed, 25 May 2016 22:02:50 +0200, Hans-Bernhard BrÃker wrote:
> On May 25 11:28, KOBAYASHI Shinji wrote:
>> The intention of the following code in tzsetwall() should be to pick
>> up UPPERCASE letters "in ASCII range":
> Are you sure you're not mixing ASCII with '8-bit character' range there?
I'm not sure if non-ASCII 8-bit characters are allowed as TZ
names. I just guessed the intention from the fact isupper() is used,
and from the description of isupper() man page:
- isupper is a macro which classifies ASCII integer values by table
lookup.
- It is defined only when isascii(c) is true or c is EOF.
However, the implementation of isupper() seems to work for 8-bit
characters even if isascii() is false. Does the man page need some
changes?
> A proper solution may have to be more like this:
> int mapped = wctob(*src);
> /* this call is safe now because of how wctob() works: */
> if (isupper(mapped)) {
> *dst++ = (unsigned char)mapped;
> }
Thank you for pointing out wctob(). I'm in favor of fixing this way.
On Wed, 25 May 2016 10:44:30 +0200, Corinna Vinschen wrote:
> 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?
It seems that it depends on locale. The man page (on Linux) says:
The behavior of towlower() depends on the LC_CTYPE category of the
current locale.
I observed that it returns 0xff41 when LANG=ja_JP.UTF-8, and 0xff21
when LANG=C.
Cygwin's implementation (and man page) does not seem to depend on
locale.
Regards,
KOBAYASHI Shinji.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple