delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/02/09/09:25:01

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Message-ID: <4F33D71A.9040105@gmail.com>
Date: Thu, 09 Feb 2012 15:24:26 +0100
From: marco atzeri <marco DOT atzeri AT gmail DOT com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120129 Thunderbird/10.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: how to set locale with C++
References: <4F33AA60 DOT 6080704 AT gmail DOT com> <20120209123738 DOT GG23330 AT calimero DOT vinschen DOT de>
In-Reply-To: <20120209123738.GG23330@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

On 2/9/2012 1:37 PM, Corinna Vinschen wrote:
> On Feb  9 12:13, marco atzeri wrote:
>> Attached a small example taken from Bruce Eckel Thinking in C++
>>
>> On cygwin both this call
>>
>>    cout.imbue(locale("en_US.UTF-8"));
>>
>>    cout.imbue(locale("fr_FR.UTF-8"));
>>
>> raise exception
>>
>> "terminate called after throwing an instance of 'std::runtime_error'
>>    what():  locale::facet::_S_create_c_locale name not valid
>> Aborted (core dumped)"
>>
>> I could understand eventually the second one, but "English (US)" is
>> the current windows locale so I expected that at least "en_US.UTF-8"
>> is accepted.
>>
>> What I am missing ?
>
> This doesn't look like a Cygwin issue.  The above error
> "locale::facet::_S_create_c_locale name not valid" points to some
> problem in the library implementing the locale call.  The underlying
> plain C call setlocale should work fine.
>
>
> Corinna
>

g++ 4.5.3 seems to have a problem on cygwin.

setlocale on pure C is working
(modified from
http://www.cplusplus.com/reference/clibrary/clocale/setlocale/)

$ ./setlocale.exe
Locale is: C
Date is: Thu Feb  9 14:52:45 2012
Currency symbol is:
-
Locale is: fr_FR.UTF-8
Date is: jeu.  9 févr. 2012 14:52:45
Currency symbol is: €
-


Dave,
it could be related to libstdc++ built with a different
--enable-clocale option ?

http://gcc.gnu.org/onlinedocs/libstdc++/manual/build.html

Or that functionality is not available on cygwin ?

Regards
Marco

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