From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13084 invoked by alias); 12 Jun 2014 11:36:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 13066 invoked by uid 89); 12 Jun 2014 11:36:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Jun 2014 11:36:36 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5CBaWhH001303 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jun 2014 07:36:32 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5CBaUmp032166; Thu, 12 Jun 2014 07:36:31 -0400 Message-ID: <539990BD.9020504@redhat.com> Date: Thu, 12 Jun 2014 11:36:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Yao Qi CC: Tom Tromey , Joel Brobecker , gdb-patches@sourceware.org Subject: Re: [ping] [PATCH] Different outputs affected by locale References: <1401192650-29688-1-git-send-email-yao@codesourcery.com> <538EAEE5.2080708@codesourcery.com> <20140604124708.GR4289@adacore.com> <538F1CC3.9090605@codesourcery.com> <87oay8a0t6.fsf@fleche.redhat.com> <538F803A.9020007@redhat.com> <538FE412.1050806@codesourcery.com> <53903119.6000204@redhat.com> <53903EE5.8090107@codesourcery.com> <539042A2.4050409@redhat.com> <539571C6.40605@codesourcery.com> <53958862.5020106@redhat.com> <5397BCEC.8080300@codesourcery.com> In-Reply-To: <5397BCEC.8080300@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-06/txt/msg00498.txt.bz2 On 06/11/2014 03:20 AM, Yao Qi wrote: > On 06/09/2014 06:11 PM, Pedro Alves wrote: >> I think the test caught a real GDB bug on Windows, and we >> should fix GDB to make it look at the environment variables, >> as is expected of GNU programs. And that the best way >> to handle this is to import the gnulib setlocale module. > > I've started setlocale module import, but during the work, I did some > experiments and the result is confusing me. > > We import setlocale so that we can set locale through env var, assuming > that different locales affect the return value of iswprint (0xa2). > However, this assumption isn't true on Windows :( Well, it actually is. > > I write the following program to check the return value of iswprint > under different locales. > > On Linux, the output is reasonable > $ ./iswprint > 4 > C: 0 > en_US.UTF-8: 1 > C: 0 > > On Windows, iswprint always return true! > C:\>iswprint.win.exe > 2 > C: 16 > English_United States.1252: 16 This shows that what happens is that on Windows the LC_CTYPE=C picks up the CP-1252 Windows code page (Latin 1), an extended ASCII code page. And in that code page, 162 is printable. > C: 16 > > iswprint return value depends on LC_CTYPE, but under LC_CTYPE=C, > iswprint (0xa2) behaves differently on Windows and Linux. > The difference is really in what locale/code page LC_CTYPE=C picks up. What does "show host-charset" show on Windows, before and after you make GDB pick LC_CTYPE=C from the environment (with the setlocale gnulib module)? (Ideally, the wchar tests would actually iterate testing GDB behaves as expected with different values of LC_CTYPE, etc. set in the environment. With all other tests assuming ASCII as set by default by the testsuite framework.) -- Pedro Alves