问题
I create a chrome extension using Firebreath: http://slimtext.org And I meet a problem: the extension does not support Chinese characters very well on Windows. After a lot of research I found this: http://www.boost.org/doc/libs/1_50_0/libs/locale/doc/html/default_encoding_under_windows.html
I think the solution is to use boost/locale. But the https://github.com/firebreath/firebreath-boost project does not seem to contain boost/locale. The 1.50.0 branch contains newer boost than the master branch but neither of them contains boost/locale.
I tried to use external boost, or copy the locale code from external boost, but failed.(couldn't link to locale when doing make)
What's your suggestion? How can I Use boost locale together with Firebreath ?
回答1:
firebreath-boost is just a subset of the full boost. To use all of boost install boost manually and use system boost. see http://www.firebreath.org/display/documentation/Prep+Scripts
回答2:
I failed to compile my Firebreath project with external Boost on Windows. And after a lot of investigation, I start to doubt that boost/locale is the key to my original problem: Chinese characters encoding problem.
Finally I resolved it without boost/locale:
- use wstring instead of string whenever possible
- you might have to write code separately for windows and other operating systems, example:
#ifdef _WIN32
file.open(path.c_str()); //path is std::wstring
#else
fs::path the_path(path);
file.open(the_path.generic_string().c_str());
#endif
来源:https://stackoverflow.com/questions/15457055/use-boost-locale-together-with-firebreath