nanogui: About UTF8->UTF16
Subject:
About UTF8->UTF16
From:
Joe ####@####.####
Date:
24 Apr 2006 04:28:30 +0100
Message-Id: <200604241128.09553.joe@thyme.com.tw>
Hi all,
I try to display Chinese characters on my SIGMA 8621L, so I modify fontdemo.c
and find something about converting UTF8 string to UTF16 one.
First I copy simsun.ttf as System.ttf, use GVIM with "set encoding=utf8", type
8 Chinese characters in variable buf. According to hexdump, the string uses
3-byte UTF-8 encoding. So I use GrText(w, gc, 0, y, buf, 8, MWTF_UTF8|
MWTF_BASELINE) to render string, no luck. After tracing devfont.c, I found in
utf8_to_utf16(), it exist because the 7th bytes is not valid. Try using
GrText(w, gc, 0, y, buf, 24, MWTF_UTF8|MWTF_BASELINE) , It works!
But in nano-X-docs.pdf, it says "count : the number of characters (not bytes)
in the string, do I miss something?
Regards
Joe