[Bf-committers] International Input

Yaohua Xiong xiongyaohua at gmail.com
Thu Apr 22 08:21:38 CEST 2010


Hi Harley,

> I haven’t notice anywhere that we’re using character strings that would include
> anything outside of $00-$7F. Therefore we should be able to treat all strings as
> if they *are* UTF-8. Those first 128 characters are the same and are
> represented as a single byte. In other words, text strings that contain only
> single bytes in the range $00-$7F are valid UTF-8.

Well, some CJK encoding, for example GBK which is widely use in
Mainland China, will use bytes range out of 0x7f. And these string
will come from the interaction with OS, like filename and pathname.

> For input our event loop (wm_event_system) needs a “translate_key” function to
> replace “convert_key” where we can add platform-specific code to translate
> keystrokes into characters based on the user’s input language and keyboard layout.
> For Win32 this means using GetKeyboardState, MapVirtualKeyExW,
> ToUnicodeEx, and then translating the result to UTF-8.

I'm still not clear with the event handling, but I think we need to
provide some basic IME aware funtions. For example only enable IME
when text input field got focus, and disable it afterwards.

> For Windows file operations we need to change “winstuff” to use FindFirstFileW
> and FindNextFileW instead of the ansi versions. The results would have to be
> converted from Wide to UTF-8.

If change from the ANSI version of API to the Wchar version will not
cause other side effects, I think this is the easy way. Because we
don't need to worry about what encoding the result filename is in.

Or maybe we can stick to the ANSI version API, it guarantees not to
break other part of Blender. But this time we must determine what
encoding the results are actually in. Then convert result into utf8
accordingly.

Regards,
-- 
Yaohua Xiong

Traffic and Transportation Engineering College, Tongji Univ.
Cao An Road 4800#, Jia Ding District, Shanghai,  China


More information about the Bf-committers mailing list