Also I need locale aware case conversion. .NET do this very well. Do us C++ programmers have to wait 100 years for such thing ? I am aware of the ICU library but it's 20MB and I can't even get to link my code with it.开发者_如何学Python.. All in all I want to end this nightmare..
You might want to use the API provided by the operating system. Windows has NLS API that deals with locale specific string comparison and case conversion.
Standalone Unicode Libraries are ICU and IConv. Both require some time to learn. The data file is also quite large - expect to carry > 10M data files to support most languages.
BTW, your link error is typically caused by the fact that you specified a static library but the imported function has dllimport attribute which specifies a DLL. By default ICU header files declare dllimport on its APIs. You need to define a macro before including the ICU header.
- libiconv is a cross platform unicode library, a part of glibc, and part of the POSIX.1-2001 standard. It's also available on Mac and Windows.
- UTF-8 is a character encoding that is backwards compatible with ASCII.
- C strings are null terminated byte arrays that can hold ASCII and UTF-8.
That's all you need. Encode/decode to UTF-16 and UCS-32 or what have you when required to interface with legacy operating systems.
精彩评论