Hi Kapil.
Can anyone tell me how one can add unicode support to functions ?
First, we have to distinguish between a complete Unicode support (all
those things such as combine characters, bi-directional text, collation,
etc.) and basic UCS support (e.g. correctly decoding and encoding UTF-8
strings).
We do not target the complete Unicode support yet as it is extremely
complex, but at the same time it is probably relevant only when you have
a proper font rendering (with scalable and possibly proportional fonts
such as TrueType). It is hard to deal with combine characters and
bi-directional text if your primary output is terminal-oriented. You are
right that for complete Unicode support we might reuse some universal
Unicode library eventually.
However, what we do target is the correct encoding and decoding of UCS
strings. You can either target fixed-width UTF-32 strings (one UTF-32
character is "wchar_t" and an UTF-32 string is "wchar_t *") or you can
target variable-width UTF-8 strings.
An UTF-8 string is represented just as "char *". You have to use the
functions from uspace/lib/c/generic/str.c to properly decode and encode
UTF-8 strings:
str_decode()
str_decode_reverse()
chr_encode()
Note than functions such as str_length() make use of these functions.
You can also read more about the HelenOS string API [1].
[1] http://trac.helenos.org/wiki/StringAPI
M.D.
_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/cgi-bin/listinfo/helenos-devel