c++ - boost::locale::conv utf8 to cp437 -
for last 2 days i've been trying convert utf-8
string cp437
string , i've tried this answer.
example situation converting char *utf8="\xc2\xbb"
char *cp437="\xaf"
(or 175 decimal if will).
i came many variations of this:
struct consoleoutputwrapper { boost::locale::generator generator; std::string c_output; // charset name std::locale l_output; // locale consoleoutputwrapper() : generator(), c_output("cp437") { generator.locale_cache_enabled(true); l_output = generator(c_output); } void operator<<(const char* str) { std::cout << boost::locale::conv::from_utf<char>(str, l_output); } }; // test consoleoutputwrapper k; k << "\xc2\xbb";
but best conversion i've got >
instead of »
.
any ideas how convert special characters these using boost?
Comments
Post a Comment