rockswang / haxe-i18n

Macro driven internationalization/localization toolkit for Haxe
24 stars 4 forks source link

Unicode Characters in html5 target? #4

Closed Willis77 closed 10 years ago

Willis77 commented 10 years ago

Any idea how to make the html5 target accept unicode characters (Chinese, etc.)?

I'm using this library with an OpenFL project. I can build just fine for Flash or Mac, but the html5 target still keeps coming up blank with Chinese characters.

The problem may have more to do with the html5 compilation, but I'm wondering if there's any conditional escaping that could be done that would resolve the problem.

Willis77 commented 10 years ago

I'd still be interested in your ideas on this, but a little more research makes it pretty clear that the issues have nothing to do with this library. They are instead the result of the html5 target using an embedded font with a limited number of glyphs.

The best solutions I found were on this page: http://www.openfl.org/community/bugs/textfield-350/ and seem to include generating a ttf.hash file including all the characters necessary (large file size for one language, and impossibly large for multilingual), or using a TextField's htmlText property instead of the text property.

From the link above:

#if html5
textField.htmlText = "Hello";
#else
textField.text = "Hello";
#end

This worked for me.