delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/10/05/12:04:42

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4E8C7FFB.6060707@xs4all.nl>
Date: Wed, 05 Oct 2011 18:04:11 +0200
From: Erwin Waterlander <waterlan AT xs4all DOT nl>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cygwin started speaking German today
References: <4E68AF35 DOT 9030002 AT cwilson DOT fastmail DOT fm> <201109082344 DOT 55506 DOT bruno AT clisp DOT org> <4E69D9EA DOT 2050004 AT cwilson DOT fastmail DOT fm> <CAHWeT-bQ=Qm7qyWzb9s-=Lfgwjh-vHrEk2BvYQS6X6707+EWMg AT mail DOT gmail DOT com> <20110909145921 DOT GA27289 AT calimero DOT vinschen DOT de> <4E6F7AA1 DOT 4090808 AT redhat DOT com> <20111004122837 DOT GA27229 AT calimero DOT vinschen DOT de> <4E8B0007 DOT 5020500 AT cwilson DOT fastmail DOT fm> <20111004142920 DOT GA15757 AT calimero DOT vinschen DOT de> <4E8B4A86 DOT 5000607 AT xs4all DOT nl> <20111004182042 DOT GA22299 AT calimero DOT vinschen DOT de>
In-Reply-To: <20111004182042.GA22299@calimero.vinschen.de>
X-IsSubscribed: yes
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

Op 4-10-2011 20:20, Corinna Vinschen schreef:
> On Oct  4 20:03, Erwin Waterlander wrote:
>> Corinna Vinschen schreef, Op 4-10-2011 16:29:
>>> Does it? Even if I'm running a german OS, I absolutely hate to see
>>> german diagnostic output from gcc, and I absolutely hate certain
>>> programs using non-ASCII chars in output. (In)famous examples are
>>> Unicode quoting chars rather than ' or ", or using the Unicode
>>> hyphen character rather than -. But that's just me.
>> You got used to ASCII, like all the old-timers... ;)
>> export LANG=C is your solution.
>>
>> By the way, I noticed that with the default locale C.UTF-8 the
>> nl_langinfo(CODESET) C function<langinfo.h>  returns wrongly
>> "ISO-8859-1",
> Not for me:
>
>    $ cat>  setl.c<<EOF
>    #include<stdio.h>
>    #include<locale.h>
>    #include<langinfo.h>
>
>    int main(int argc, char **argv)
>    {
>      char *loc;
>      if (argc>  1)
>        loc = setlocale (LC_ALL, argv[1]);
>      else
>        loc = setlocale (LC_CTYPE, NULL);
>      printf ("locale: %s charset: %s\n", loc, nl_langinfo (CODESET));
>      return 0;
>    }
>    EOF
>    $ gcc -o setl setl.c
>    $ ./setl
>    locale: C charset: ANSI_X3.4-1968
>    $ ./setl C
>    locale: C charset: ANSI_X3.4-1968
>    $ ./setl C.utf8
>    locale: C.utf8 charset: UTF-8
>    $ ./setl C.UTF-8
>    locale: C.UTF-8 charset: UTF-8
>
>
> Corinna
>
Hi,

My program (wcd) uses gettext/libintl. Libintl is causing the effect. 
Libintl is not working properly with a locale C.UTF-8. That is a serious 
problem.

#include <stdio.h>
#include <locale.h>
#include <langinfo.h>
#include <libintl.h>

   int main(int argc, char **argv)
   {
     char *loc;
     if (argc > 1)
       loc = setlocale (LC_ALL, argv[1]);
     else
       loc = setlocale (LC_CTYPE, "");
      bindtextdomain("setl","/usr/share/locale");
      textdomain("setl");
     printf ("locale: %s charset: %s\n", loc, nl_langinfo (CODESET));
     return 0;
   }

waterlan AT erwin2 ~/tmp
$ gcc -o setl setl.c -lintl

waterlan AT erwin2 ~/tmp
$ echo $LANG
C.UTF-8

waterlan AT erwin2 ~/tmp
$ ./setl
locale: en_US charset: ISO-8859-1

waterlan AT erwin2 ~/tmp
$ locale
LANG=C.UTF-8
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_ALL=

waterlan AT erwin2 ~/tmp
$ export LANG=nl_NL.UTF-8

waterlan AT erwin2 ~/tmp
$ ./setl
locale: nl_NL.UTF-8 charset: UTF-8

waterlan AT erwin2 ~/tmp
$ locale
LANG=nl_NL.UTF-8
LC_CTYPE="nl_NL.UTF-8"
LC_NUMERIC="nl_NL.UTF-8"
LC_TIME="nl_NL.UTF-8"
LC_COLLATE="nl_NL.UTF-8"
LC_MONETARY="nl_NL.UTF-8"
LC_MESSAGES="nl_NL.UTF-8"
LC_ALL=


-- 
Erwin Waterlander    waterlan AT xs4all DOT nl
Zeelsterstraat 59B,  5652 EB  Eindhoven,  The Netherlands
www: http://www.xs4all.nl/~waterlan/


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