0

我使用 Firebreath 创建了一个 chrome 扩展:http ://slimtext.org 我遇到了一个问题:该扩展在 Windows 上不能很好地支持中文字符。经过大量研究,我发现了这一点:http: //www.boost.org/doc/libs/1_50_0/libs/locale/doc/html/default_encoding_under_windows.html

我认为解决方案是使用 boost/locale。但是https://github.com/firebreath/firebreath-boost项目似乎不包含 boost/locale。1.50.0 分支包含比 master 分支更新的 boost,但它们都不包含 boost/locale。

我尝试使用外部提升,或从外部提升复制语言环境代码,但失败了。(在制作时无法链接到语言环境)

你有什么建议?如何将 boost locale 与 Firebreath 一起使用?

4

2 回答 2

1

firebreath-boost 只是完全提升的一个子集。要使用所有 boost 手动安装 boost 并使用系统 boost。见http://www.firebreath.org/display/documentation/Prep+Scripts

于 2013-03-17T04:30:22.023 回答
0

我未能在 Windows 上使用外部 Boost 编译我的 Firebreath 项目。经过大量调查,我开始怀疑 boost/locale 是我原来问题的关键:汉字编码问题。

最后我在没有提升/语言环境的情况下解决了它:

  1. 尽可能使用 wstring 而不是 string
  2. 您可能必须为 Windows 和其他操作系统分别编写代码,例如:

#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

于 2013-03-18T01:58:06.277 回答