
________________________________________ From: boost-bounces@lists.boost.org [boost-bounces@lists.boost.org] on behalf of Artyom Beilis [artyomtnk@yahoo.com] Sent: Thursday, November 01, 2012 15:59 To: boost@lists.boost.org Subject: Re: [boost] [locale] [filesystem] Windows local 8 bit encoding
Using Boost.Locale you can convert to locale encoding of a given std::locale() object generated with Boost.Locale.
boost::locale::generator allows to select legacy "ANSI" encoding instead of UTF-8 to be default upon creation of the locale object that corresponds to the system locale.
This object you can use with to_utf and from_utf functions.
Unfortunately that does not work under Microsoft Windows as generator locale_generator ; locale_generator.use_ansi_encoding( true ) ; std::locale const current_locale = locale_generator.generate( name ) ; needs a name.
Similar to creating std::locale("") the generation locale_generator.generate("") gives the expected result, i.e. system default locale.
Unfortunately under Microsoft Windows this only gives the 'hardwired' "UTF-8" encoding: void prepare_data() { ... if(locale_id_.empty()) { real_id_ = util::get_system_locale(true); // always UTF-8 ... } ... } where util::get_system_locale(false) would at least do part of the mapping from codepage to encoding (see my initial posting). Best regards Bjoern.