是否有适用于 ICU 或其他强大的 Unicode 库的 STL 和 UTF-8 友好的 C++ Wrapper [英] Is there an STL and UTF-8 friendly C++ Wrapper for ICU, or other powerful Unicode library

查看:20
本文介绍了是否有适用于 ICU 或其他强大的 Unicode 库的 STL 和 UTF-8 友好的 C++ Wrapper的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个好的 C++ Unicode 库.我需要:

I need a good Unicode library for C++. I need:

  1. 以 Unicode 敏感的方式进行转换.例如,以不区分大小写的方式对所有字符串进行排序,并获取它们的第一个字符作为索引.将各种 Unicode 字符串转换为大写和小写.在合理的位置拆分文本 - 也适用于中文和日文的单词.
  2. 以区域设置敏感的方式格式化数字、日期(应该是线程安全的).
  3. 对 UTF-8(主要内部表示)的透明支持.

据我所知,最好的图书馆是 ICU.但是,我找不到带有示例的普通开发人员友好的 API 文档.另外据我所知,它不太友好现代 C++ 设计,使用 STL 等等.像这样:

As far as I know the best library is ICU. However, I can't find normal developer friendly API documentation with examples. Also as far as I see, it is not too friendly with modern C++ design, work with STL and so on. Like this:

std::string msg;
unistring umsg.from_utf8(msg);
unistring::word_iterator wi;
for(wi=umsg.words().begin(),n=0;wi!=usmg.words().wi_end(),n<10;++wi,++n) 
  ;
msg=umsg.substr(umsg.words().begin(),wi).to_utf8();
cout<<_("Five 10 words are ")<<msg;

是否有在开源许可下发布的对 STL 友好的 ICU 包装器?Preferred 是许可许可,如 MIT 或 Boost,但其他许可,如兼容 LGPLv2,也可以.

Is there a good STL friendly ICU wrapper released under Open Source license? Preferred is a license permissive like MIT or Boost, but others, like LGPLv2 compatible, are OK as well.

还有其他类似ICU的高质量图书馆吗?

Is there another high quality library similar to ICU?

平台:Unix/POSIX,不需要 Windows 支持.

Platform: Unix/POSIX, Windows support is not required.

很遗憾我没有登录,所以我无法接受答案.我自己附上了答案.

unfortunately I wasn't logged in, so I can't make accept an answer. I have attached the answer by myself.

推荐答案

这个问题我自己问了很久.没有这样的图书馆.

This question was asked quite a long time before by myself. There was no such library.

所以我写的 C++ 友好 Boost.Locale包装 ICU 的库.

So I had written C++ friendly Boost.Locale library that wraps ICU.

编辑现在是 Boost 的一部分:参见 Boost.Locale 文档

Edit Now part of Boost: see Boost.Locale documentation

这篇关于是否有适用于 ICU 或其他强大的 Unicode 库的 STL 和 UTF-8 友好的 C++ Wrapper的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆