Boost logo

Boost :

Subject: Re: [boost] [locale] [filesystem] Windows local 8 bit encoding
From: Thiel, Bjoern (bjoern.thiel_at_[hidden])
Date: 2012-11-01 12:08:21


________________________________________
From: boost-bounces_at_[hidden] [boost-bounces_at_[hidden]] on behalf of Artyom Beilis [artyomtnk_at_[hidden]]
Sent: Thursday, November 01, 2012 15:59
To: boost_at_[hidden]
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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk