[Bf-committers] International Input

Harley Acheson hacheson at shawnigan.ca
Thu Apr 22 06:23:19 CEST 2010


Yaohua Xiong, 

I’m still struggling with the Blender source, so I probably have an overly 
simplistic view of this or am outright wrong, but... 


> The font rendering infrastructure(BLI_Font) support utf8. Good news, 
> but it also means every character needs to be translated into utf8. 

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. 


> 2. OR add a platform independent mechanism to determine the locales, 
> and translate the relevant BLI_fileops results from local encoding into utf8. 

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. 


> 1. use platform specific unicode version of file operation API in the 
> implementation of BLI_fileops and encode the (probably) wchar 
> filename into utf8. 

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. 

Output already supports UTF-8 so this _should_ be most of the work done, 
except for some miscellaneous path-processing routines in path_util and winstuff 
that will try to mangle everything. 

Isn’t that about it? Except of course, for all of the stuff I’m forgetting or don’t know 
about! 

Harley 




More information about the Bf-committers mailing list