Anyone knows of some good Unicode tutorials with examples in C? I have to create a console app (to be run in xterm), with Unicode support, and it has to be on C. :(
+1
A:
Most of the string libraries support unicode representation of string encodings ... sprint
and swprintf
. The libraries are pretty comprehensive. Conversion though libiconv is also pretty good. Providing the terminal supports Unicode then it should IIRC handle the conversion from wchar_t to the right encoding for the UI.
Just remember, encoding!=code-points.
Aiden Bell
2009-07-03 19:32:48
+1 for encoding != code-points. Also remember that what a user calls a character may need more than one code point, and may even be represented by more than one valid sequence of code points. Unicode is easiest if you never look inside the strings ;-)
RBerteig
2009-07-03 21:08:55
+2
A:
This might help you to get started. This handles UTF8-encoded unicode though.
Magnus Skog
2009-07-03 19:36:16
A:
I prefer to use Glib for dealing with unicode strings in C/C++ (at least until C++0x is a little more mainstream).
Here's the relevant library documentation on Unicode Manipulation
Internally everything is stored as UTF-8, but you can use any of the UTF-x formats for doing I/O.
David Claridge
2009-08-06 01:31:30