问题标签 [boost-locale]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
204 浏览

c++ - Boost Locale 边界分析不适用于 char16_t

我试图用来boost::locale::boundary::segmant_index分析由char16_t符号组成的字符串中的边界。但是编译时出现如下错误(B​​oost 1.54, GCC 4.8.1):

UPD:这是示例

0 投票
4 回答
13193 浏览

c++ - 使用纯 C++/Boost 读取/写入具有 unicode 文件名的文件

我想使用 boost 文件系统读取/写入具有 unicode 文件名的文件,在 Windows (mingw) 上提升语言环境(最后应该与平台无关)。

这是我的代码:

fs::exists真正检查名称äöü.txt为. 但写入的文件名为äöü.txt.

阅读给出了同样的问题。使用fs::wofstream也无济于事,因为这只是处理宽输入。

如何使用 C++11 和 boost 解决这个问题?

编辑:发布的错误报告:https ://svn.boost.org/trac/boost/ticket/9968

澄清赏金:使用 Qt 非常简单,但我想要一个仅使用 C++11 和 Boost,没有 Qt 和没有 ICU 的跨平台解决方案。

0 投票
1 回答
517 浏览

boost - 无法在 Visual C++ 2013 上使用 ICU 53.1 构建 Boost::Locale

我正在尝试使用“Building Boost.Locale”指令构建 Boost::Locale(Boost 版本 1.56)。首先,几个月前我成功安装了完整的 Boost 库,它创建了许多 Boost::Locale .dll 和 .lib 文件:

今天,我下载了 ICU4C 53.1 并构建了它(调试和发布)。我将以下目录添加到我的计算机路径中:

接下来,我进行了 ICU 测试,它们运行良好。

然后我尝试将 Boost::Locale 与 ICU 链接,并按照 Locale 安装说明中的说明进行了以下操作:

在命令提示符下,我输入:

它表明它正在构建并在屏幕上显示“...耐心...找到 1214 个目标...”

以下是 D:\boost_1_56_0\bin.v2\config.log 的结果:

在这一点上,我不知道“目标”更新了什么,所以我使用get_all_backends()创建了一个小型测试应用程序来查看支持哪些后端。不幸的是,只列出了winapistd 。

有人可以建议可能出了什么问题吗?

更新

打开 Locale jam 文件后:

我对此不确定,但上面的代码片段指的是 icudt,我注意到 dll 文件附加了 ICU 的版本,即:icudt

我将更新引用以匹配附加版本,即:icudt53,看看会发生什么。

0 投票
0 回答
157 浏览

c++ - boost::locale 在两个独立但相同的系统上表现不同

我有这个程序:

Debian Wheezy它在使用gcc 4.7.2-5和运行的两个不同但相同的系统上表现不同boost 1.49。两个系统具有相同的语言环境en_US.UTF-8

上面的程序在大约Thu Sep 25 2014 11:15 UTC.

系统 A 上的输出

系统 B 上的输出

这应该是什么原因造成的?

注意:目前 DST 对欧洲/柏林有效


更新:

libboost1.49-dev在这两个系统上都是从 Debian 存储库安装的,如下所示:

还验证了在两个系统上都有依赖关系libboost_locale.solibicuuc.solibicui18n.solibicudata.so

0 投票
1 回答
205 浏览

c++ - Boost Locale – 直接访问 ICU 功能

我最近开始使用 Boost Locale 遍历和 Unicode 字符串的边界分析。我使用了一些可用于大小写转换的功能,即:to_upper(),它似乎包装了 ICU 的 toUpper() 函数。

我没有找到其他 ICU 功能(例如u_isalpha()u_isalnum() )的 Boost Locale 包装器。我该如何使用这些 ICU 功能?

谢谢!

0 投票
2 回答
180 浏览

c++ - boost::locale::transform 的可移植使用

我实现了对字符串中的子字符串的搜索,我想让这个搜索“重音自然”或者它可能被称为粗糙 - 如果我在“rábano”中开始搜索“aba”,我应该会成功。

Find substring in string using locale中有一个有效的答案:

此解决方案的唯一问题 - 转换将几个字节添加到字符串的末尾。在我的情况下,它是“\x1\x1\x1\x1\x0\x0\x0”。四个字节,一个 1 和几个零字节。当然,擦除这些字节很容易,但我不想依赖这种微妙的实现细节。(代码应该是跨平台的)

有没有更靠谱的方法?

0 投票
1 回答
230 浏览

visual-studio-2010 - boost::locale 1.57.0 和 Windows 下的 ICU 库 54.1 (VC++ 2010)

我正在尝试在 Windows 8.1 下使用 ICU 库支持 54.1 构建 Boost::locale 1.57.0。我在 C:\icu 上有包含以下文件的库:

我运行了以下内容:

但后来我收到以下消息:

这些消息意味着我根本不会得到 ICU 支持?这里可能是什么问题?

0 投票
2 回答
84 浏览

c++ - Is There an Upper Bound in my locale for Time Related Information?

Is there a definition somewhere in the standard namespace that sets forward:

  1. Months in a year
  2. Days in a week
  3. Hours in a day
  4. Minutes in an hour
  5. Seconds in a minute

The struct tm has contains member variables that must be in these ranges, but I can't find the defined limits anywhere.

I'm not even sure if there are locales defined where these wouldn't match the conventional set (12/7/24/60/60).

Even if there aren't potential users with other range limits, I'd sure like to use a define from the standard namespace rather than arbitrarily defining my own.

EDIT:

It looks like I'm not the first to ask for such a thing: http://david.tribble.com/text/c0xcalendar.html I notice in this proposal there is mention of the struct calendarinfo which does exactly what I'm looking for.

It looks like the last change on this was 2009. I guess nothing's happened since then? I guess that also means this stuff is not readily available to me?

More info, boost::locale::calendar::maximum seems to accomplish exactly what I'm looking for. I can't use Boost, but I'm certain that the code in Boost is the defacto standard on how to come up with these limits. Unfortuantely I can't seem to get at the implementation of maximum. Maybe someone else here knows how?

0 投票
1 回答
255 浏览

c++ - 是否有可能获得提升语言环境边界分析以拆分撇号?

例如考虑以下代码:

这输出:

是否可以自定义边界分析,以便输出:

我已经阅读了http://www.boost.org/doc/libs/1_56_0/libs/locale/doc/html/boundary_analysys.html并搜索了 Stack Overflow 和 Google,但到目前为止还没有找到任何东西。

0 投票
1 回答
463 浏览

c++ - 使用 boost::locale/ICU 边界分析与中文

使用boost::locale 文档中的示例代码,我无法正确标记中文文本:

这将中华人民共和国</a>拆分为七个不同的字符中/华/人/民/共/和/国,而不是预期的中华//人民共和国。编译 Boost的ICU 文档声称中文应该开箱即用,并使用基于字典的分词器来正确拆分短语。使用示例日语测试短语“生きるか死ぬか、それが问题だ。”在上面的代码中使用“ja_JP.UTF-8”语言环境确实有效,但这种标记化不依赖于字典,只依赖于汉字/假名边界。

我已经按照这里的建议直接在 ICU 中尝试了相同的代码,但结果是一样的。

知道我做错了什么吗?