Boost logo

Boost :

Subject: [boost] Silly Boost.Locale default narrow string encoding in Windows
From: Alf P. Steinbach (alf.p.steinbach+usenet_at_[hidden])
Date: 2011-10-27 12:25:31


When I engage the compiler-in-my-mind to the example given at

   http://cppcms.sourceforge.net/boost_locale/html/

namely

<code>
#include <boost/locale.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>

int main()
{
     // Create and install global locale
     std::locale::global(boost::locale::generator().generate(""));
     // Make boost.filesystem use it
     boost::filesystem::path::imbue(std::locale());
     // Now Works perfectly fine with UTF-8!
     boost::filesystem::ofstream hello("שלום.txt");
}
</code>

then it fails to work when the literal string is replaced with a `main`
argument.

A conversion is then necessary and must be added.

It breaks the principle of least surprise.

It breaks the principle of not paying for what you don't (want to) use.

I understand, from discussions elsewhere, that the author(s) have chosen
a narrow string encoding that requires inefficient & awkward conversions
in all directions, for political/religious reasons. Maybe my
understanding of that is faulty, that it's no longer politics & religion
but outright war (and maybe that war is even over, with even Luke
Skywalker dead or deadly wounded). However, I still ask:

why FORCE INEFFICIENCY & AWKWARDNESS on Boost users -- why not just do
it right, using the platforms' native encodings.

Cheers,

- Alf


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