public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: KOBAYASHI Shinji <koba@jp.fujitsu.com>
To: cygwin@cygwin.com
Subject: Re: Invalid tm_zone from localtime() when TZ is not set
Date: Thu, 26 May 2016 12:16:00 -0000	[thread overview]
Message-ID: <o8xh9dltilz.wl-koba@jp.fujitsu.com> (raw)
In-Reply-To: <2eddaaf6-4e37-cd9b-aa9d-8a87234d0cf9@t-online.de>	<20160525084430.GA17601@calimero.vinschen.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

  reply	other threads:[~2016-05-26  6:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20  0:45 Necessity for the assignment form KOBAYASHI Shinji
2016-05-20  1:22 ` Warren Young
2016-05-20  4:22   ` Invalid tm_zone from localtime() when TZ is not set KOBAYASHI Shinji
2016-05-20  7:09     ` Csaba Raduly
2016-05-20 10:16       ` KOBAYASHI Shinji
2016-05-25  9:28         ` KOBAYASHI Shinji
2016-05-25 10:15           ` Corinna Vinschen
2016-05-26 11:03             ` Hans-Bernhard Bröker
2016-05-26 12:16               ` KOBAYASHI Shinji [this message]
2016-05-26 14:56                 ` Corinna Vinschen
2016-05-26 17:21                   ` KOBAYASHI Shinji
2016-05-26 17:21                 ` Hans-Bernhard Bröker
2016-05-20  5:46 ` Necessity for the assignment form David Stacey
2016-05-20 11:36   ` KOBAYASHI Shinji

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=o8xh9dltilz.wl-koba@jp.fujitsu.com \
    --to=koba@jp.fujitsu.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).