firebreathboost-locale

Use boost locale together with Firebreath


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 ?


Solution

  • 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