nanogui: Thread: About UTF8->UTF16


[<<] [<] Page 1 of 1 [>] [>>]
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		
Subject: Re: [nanogui] About UTF8->UTF16
From: "Greg Haerr" ####@####.####
Date: 25 Apr 2006 22:59:22 +0100
Message-Id: <117b01c668b3$49a62de0$0300a8c0@RDP>

: 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?

It appears our docs must be incorrect here.  I suspect the issue
is that for UC16, and ASCII, we want a character count, but for
UTF8, since it's variable-length encoded, we want a byte count.

I'll look into this and respond with more detail.

Regards,

Greg


[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.