Use boost locale together with Firebreath

女生的网名这么多〃 提交于 2019-12-11 19:16:57

问题


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:

  1. use wstring instead of string whenever possible
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!