tags:

views:

2550

answers:

3

What is the best unicode library for C? Where "best" is defined by cross-platform support, compiler independence, and reasonable performance across a the most common languages in use.

A: 

Why not use the wchar_t built into your fine C++ compiler?

Celestial M Weasel
unicode is a lot more complex than just storing the charpoints :)
Armin Ronacher
Also, from the wiki article on wchar:The width of wchar_t is compiler-specific. programs that need portability across C++ compilers shouldn't use wchar_t for storing Unicode. The wchar_t type is intended for storing compiler-defined wide characters, which may be Unicode characters in some compilers
workmad3
Does C support wchar_t? Or is that just C++?
Ferruccio
C does support wchar_t, it's standard since agesRegards Friedrich
Friedrich
In the interest of science, which compilers treat wchar_t as unicode and which do not?
TokenMacGuy
@TokenMacGuy: `wchar_t` cannot be treated as Unicode because they are completely different things. `wchar_t` is just some arbitrary integral type, Unicode is an international standard defined by the Unicode Consortium and consisting of various parts that go way beyond simple encoding issues.
Philipp
From a practical point of view, on Windows `wchar_t` can always be used as an UTF-16 code unit. This is one of the data type requirements that the Windows API header files implicitly define (other include `CHAR_BITS = 8` or `sizeof(int) = 4`). All compilers must follow these implicit rules, otherwise every Windows program would fail to compile or crash.
Philipp
+12  A: 

Definitively ICU: http://www.icu-project.org/

Armin Ronacher
+10  A: 

I would suggest IBM's ICU library. It has a very large C, C++ and Java library set. Our company uses this in our commercial product - It is free and open source.

http://www-01.ibm.com/software/globalization/icu/index.jsp and http://www.icu-project.org/

Thomas