Re: [Boost-bugs] [Boost C++ Libraries] #8570: boost::locale::generator::use_ansi_encoding bug: gives the unexpected result on Win7 Chinese.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8570: boost::locale::generator::use_ansi_encoding bug: gives the unexpected result on Win7 Chinese.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-14 01:34:31


#8570: boost::locale::generator::use_ansi_encoding bug: gives the unexpected
result on Win7 Chinese.
-------------------------------+--------------------------------------------
  Reporter: 316293804@… | Owner: artyom
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: locale
   Version: Boost 1.53.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+--------------------------------------------

Comment (by anonymous):

 Sorry, the format is chaos.
 Follow is the right format:


 void f()

 {

 boost::locale::generator gen;

 std::string strLocaleName;




 gen.use_ansi_encoding(true);

 strLocaleName = std::use_facet<boost::locale::info>( gen("")).name();




 gen.use_ansi_encoding(false);

 strLocaleName = std::use_facet<boost::locale::info>( gen("")).name();

 }




 strLocaleName always "zh_CN.UTF-8",

 why i can't get "zh_CN.GB2312" ?




 I want to convert wstring to string.

 But

 string = boost::locale::conv::from_utf(wstring, gen(""));

 is same with

 string = boost::locale::conv::from_utf(wstring, gen("UTF-8"));

 so it gives the unexpected result.







 And why get_system_locale give the expected result ?

 get_system_locale(true); // "zh_CN.UTF-8"

 get_system_locale(false); // "zh_CN.windows-936"




 So I have to use this code,

 boost::locale::generator gen;

 strCodePage = boost::locale::util::get_system_locale();

 string = boost::locale::conv::from_utf( wstring,

 std::use_facet<boost::locale::info>(gen(strCodePage)).encoding());




 Is this a bug of boost::locale::generator::use_ansi_encoding ?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8570#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC