Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not display chinese #25

Open
hlizard opened this issue Aug 5, 2020 · 8 comments
Open

Can not display chinese #25

hlizard opened this issue Aug 5, 2020 · 8 comments
Labels

Comments

@hlizard
Copy link

hlizard commented Aug 5, 2020

image
win10+Haxe 4.1.3: it's wrong ,Chinese garbled!

also HaxeFoundation/hxcpp#842

@ianharrigan
Copy link
Member

what version of haxe / hxcpp are you using?

@hlizard
Copy link
Author

hlizard commented Aug 5, 2020

Haxe 4.1.3
hxcpp 4.1.15
haxeui-core 1.1.1
haxeui-hxwidgets 1.1.0
hxWidgets 1.6.0

@ianharrigan
Copy link
Member

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.

@hlizard
Copy link
Author

hlizard commented Aug 6, 2020

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

Sorry, my english is poor.

also HaxeFoundation/hashlink#406

@ianharrigan
Copy link
Member

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

@hlizard
Copy link
Author

hlizard commented Aug 6, 2020

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);
	}
}

@hlizard
Copy link
Author

hlizard commented Feb 26, 2021

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

@tabris17
Copy link

tabris17 commented Feb 21, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants