Open hlizard opened 3 years ago
what version of haxe / hxcpp are you using?
Haxe 4.1.3 hxcpp 4.1.15 haxeui-core 1.1.1 haxeui-hxwidgets 1.1.0 hxWidgets 1.6.0
Obviously i dont speak Chinese, but would i be correct in thinking that the "trace" in your screenshot is also incorrect? If that is the case then it would seem to be a haxe issue - the issue you linked seemed to indicate there is a fix for it, though it may be in a nightly.
Yes, "trace" is also incorrect, but there is a PR in hxcpp to "trace", but it no for GUI, may be is diff. Other, I found the neko, hashlink target of haxeui-openfl also not display Chinese(flash and html target is right), but some diff, Chinese is missing:
Sorry, my english is poor.
I would try that PR, or latest git version of hxcpp and see if that helps - im not too sure about OpenFL + HL.
In the meantime, could you paste some Chinese characters that i could test?
Thanks! Ian
import haxe.ui.Toolkit;
import haxe.ui.components.Button;
import haxe.ui.containers.VBox;
import haxe.ui.core.Screen;
class Main {
static function main() {
trace("你好, 中国!");
trace("你好, 中国!".length);
Toolkit.init();
var main = new VBox();
var button1 = new Button();
button1.text = "按钮 1";
main.addComponent(button1);
var button2 = new Button();
button2.text = "按钮 2";
main.addComponent(button2);
var input = new TextField();
main.addComponent(input);
Screen.instance.addComponent(main);
}
}
Test on Linux no problem!
haxe=4.2.0 haxeui-core=1.2.2 haxeui-hxwidgets=1.2.1 haxeui_core=1.2.2 hxWidgets=1.7.1 hxcpp=4.2.1
This is a problem specific to Windows.
The reason for this problem is that hxwidgets uses utf-8 encoding, while the Chinese windows system uses cp936 (GBK) encoding by default.
You can refer to this article to solve the problem of Chinese garbled characters Use UTF-8 code pages in Windows apps
BTW: Should hxwidgets consider allowing users to customize UI string encoding?
also https://github.com/HaxeFoundation/hxcpp/issues/842