I need a good Unicode library for C++. I need:
- Transformations in a Unicode sensitive way. For example sort all strings in a case insensitive way and get their first characters for index. Convert various Unicode strings to upper and to lower case. Split text at a reasonable position -- words that would work for Chinese and Japanese as well.
- Formatting numbers, dates in locale sensitive way (should be thread safe).
- Transparent support of UTF-8 (primary internal representation).
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;
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.
Is there another high quality library similar to ICU?
Platform: Unix/POSIX, Windows support is not required.
Edit: unfortunately I wasn't logged in, so I can't make accept an answer. I have attached the answer by myself.
The wxWidgets GUI toolkit has some rather nice string classes and unicode support. You don't need to build/use GUI classes if you don't want to. See here for details.
Does this fit the bill?
http://www.codeproject.com/KB/string/utf8cpp.aspx
This question was asked quite a long time before by myself. There was no such library.
So I had written C++ friendly Boost.Locale library that wraps ICU.
Edit Now part of Boost: see Boost.Locale documentation