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: Fri, 20 May 2016 10:16:00 -0000	[thread overview]
Message-ID: <o8x37pd6nlm.wl-koba@jp.fujitsu.com> (raw)
In-Reply-To: <CAEhDDbA-ATpAtVggR7cfqn58AHw0sPK_Y3mNSJ8UO29sg2ZpuA@mail.gmail.com>


Hi,

>>>>>	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
compromise.

>> 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.

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-20 10:16 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 [this message]
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
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=o8x37pd6nlm.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).