delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/05/26/08:16:58

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:cc:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=PEm0Po/RCr3V4nXe
8bz2UXhqyAqvkRfYNOb4d8o477kUXU5/Yea8w9Lf7AxKy2CLLW9V2t1BQzI69ml9
30kQuC2aSCNGRBdN+n05lRmI/e+I/VsuaBOACDGHRQauQ+9rmUg7GoYl0m3x74x+
AmqmFe3Ftc8dUEQpQeVzdh3p+fY=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:cc:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=fIpI84rWo8wz04E8mrkh7i
LrKsY=; b=O5s4dAWdd6QrD46XYIpvIUNApzrMGP+nL6JbsdPeJau3cULXR9n5PM
WPNIgou63ir94WUUx4JpAyhjdx3Lx084mrFpusIDGsgBhNwR0tn8RkqtA+7KtLAU
P+Pnk6vitZ4QPWJ+sGiOSeZdcNCBt499kvoANHI9uHebC2e6iDt90=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Cygwins, Cygwin's, letter, HContent-Transfer-Encoding:8bit
X-HELO: mailout09.t-online.de
Subject: Re: Invalid tm_zone from localtime() when TZ is not set
To: KOBAYASHI Shinji <koba AT jp DOT fujitsu DOT com>
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>
From: =?UTF-8?Q?Hans-Bernhard_Br=c3=b6ker?= <HBBroeker AT t-online DOT de>
Cc: cygwin AT cygwin DOT com
Message-ID: <292874c9-8b43-9693-8c1f-c4d107af4a9c@t-online.de>
Date: Thu, 26 May 2016 14:16:25 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0
MIME-Version: 1.0
In-Reply-To: <o8xh9dltilz.wl-koba@jp.fujitsu.com>
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019