how to set locale with C++

marco atzeri marco.atzeri@gmail.com
Thu Feb 9 11:14:00 GMT 2012


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 ?

Regards
Marco
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Locale.cpp
URL: <http://cygwin.com/pipermail/cygwin/attachments/20120209/1d1d243c/attachment.ksh>
-------------- next part --------------
--
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


More information about the Cygwin mailing list