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: Hans-Bernhard BrÃker <HBBroeker at t-online dot de>
- To: KOBAYASHI Shinji <koba at jp dot fujitsu dot com>
- Cc: cygwin at cygwin dot com
- Date: Thu, 26 May 2016 14:16:25 +0200
- 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> <o8xh9dltilz dot wl-koba at jp dot fujitsu dot com>
Am 26.05.2016 um 08:54 schrieb KOBAYASHI Shinji:
On Wed, 25 May 2016 22:02:50 +0200, Hans-Bernhard BrÃker wrote:
On May 25 11:28, KOBAYASHI Shinji wrote:
- 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.
That restriction is artificial, at best. I might go so far as to say
it's a direct standard violation since, according to the C Standard, the
<ctype.h> macros/functions are defined for the entire range of unsigned
char, not just ASCII's 0 ... 127.
It's also untrue. Once you set the locale and the console character set
accordingly, Cygwin's isupper() does work for characters outside the
7-bit ASCII range, too:
$ ./tisupper.exe a A b B Ã Ã Ã
a: isupper=0
A: isupper=1
b: isupper=0
B: isupper=1
Ã: isupper=0
Ã: isupper=1
Ã: isupper=0
This is with a ISO-Latin-15 mintty, and LANG set to de_DE (note: no
UTF-8), running this program:
#include <stdio.h>
#include <ctype.h>
#include <locale.h>
int main(int argc, char **argv)
{
int i = 0;
setlocale(LC_ALL, "");
for (i = 1; i < argc; i++) {
printf("%c: isupper=%d\n",
argv[i][0],
isupper((unsigned char)argv[i][0])
);
}
return 0;
}
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.
So does the implementation in Cygwin. The result of my little test is
influenced by locale. E.g. in Russian locale, Ã is no longer classified
an upper-case letter.
--
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