I'm having trouble using boost to convert between different string encoding. After reading this, I tried doing this:
boost::locale::generator gen;
std::locale loc = gen.generate("");// encoding local to the computer.
//std::locale loc = gen.generate("en_US.UTF-8"); // tried this too
//std::locale loc = gen.generate("en_US.UTF-8"); //doesn't work either
std::string someString = "test me";
std::string output = boost::locale::conv::to_utf<char>(someString, loc);
But it always fails with a std::bad_cast when it tries use_facet() inside to_utf.
This would suggest that the boost locale::info facet isn't available for the locale being generated. But I tried a few different generations with no luck, and I expect the system default to always work, so I must be doing something wrong else where.
Any ideas?