Why does boost::locale::generator fail for some locale codes?
I am using boost::locale::generator with its default backend (ICU I assume) to generate an std::locale. But for some reason, when I pass certain locale codes to the generator, it fails and the application execution is interrupted with the following output messages: terminate called after throwing an instance of 'boost::locale::conv::conversion_error' what(): Conversion failed Abortado I have tested the following values: * gl — FAILS * gl_ES — FAILS * gl_ES.utf8 — Works * en — Works * en_US — Works * en_US.utf8 — Works Installed locales should not be the issue: [user@localhost build]$ locale -a C en_US en_US.iso88591 en_US.utf8 galego galician gl_ES gl_ES@euro gl_ES.iso88591 gl_ES.iso885915@euro gl_ES.utf8 POSIX So why might this be happening?
________________________________ From: Adrián Chaves Fernández (Gallaecio)
To: boost-users@lists.boost.org Sent: Tuesday, May 15, 2012 5:28 PM Subject: [Boost-users] Why does boost::locale::generator fail for some locale codes? I am using boost::locale::generator with its default backend (ICU I assume)
ICU us default if Boost.Locale is compiled with ICU support.
when I pass certain locale codes to the generator, it fails and the application execution is interrupted with the following output messages:
terminate called after throwing an instance of 'boost::locale::conv::conversion_error' what(): Conversion failed Abortado I have tested the following values: * gl — FAILS * gl_ES — FAILS * gl_ES.utf8 — Works * en — Works * en_US — Works * en_US.utf8 — Works
See: http://www.boost.org/doc/libs/1_49_0/libs/locale/doc/html/index.html In generally the locale should consist of LANGUAGE_TERRITORY.ENCODING So proper locale names are gl_ES.utf8 and en_US.utf8 Note, if encoding is not given US-ASCII is assumed... and so conversions of any non-ASCII characters like dictionaries during load would fail.
Installed locales should not be the issue: [user@localhost build]$ locale -a C en_US en_US.iso88591 en_US.utf8 galego galician gl_ES gl_ES@euro gl_ES.iso88591 gl_ES.iso885915@euro gl_ES.utf8 POSIX
ICU does not use system installed locales rather its own locale DB. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
participants (3)
-
Adrián Chaves Fernández
-
Adrián Chaves Fernández (Gallaecio)
-
Artyom Beilis