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

"How to display UTF-8 encoded text using ImGui.NET in C#" #474

Open
HuaChenDu opened this issue Apr 23, 2024 · 5 comments
Open

"How to display UTF-8 encoded text using ImGui.NET in C#" #474

HuaChenDu opened this issue Apr 23, 2024 · 5 comments

Comments

@HuaChenDu
Copy link

Resolving the issue of UTF-8 strings displaying as '??????'
屏幕截图 2024-04-23 085923
屏幕截图 2024-04-23 085800
屏幕截图 2024-04-23 085945

@HuaChenDu
Copy link
Author

屏幕截图 2024-04-23 090336
屏幕截图 2024-04-23 090400
I attempt to solve using the mindset of C++ code, or to display???

@mellinoe
Copy link
Collaborator

You need to do something like what is described here: #67

@HuaChenDu
Copy link
Author

You need to do something like what is described here: #67
I still don't understand. Could you teach me how to modify my code?
my code:
namespace ImGuiNET
{
public class Program : Overlay
{
bool checkBoxValue = false;
int loveMeter = 0;
string input = "";
string input2 = "";
bool showWindow = true;

	protected override void Render()
	{
		ImGui.Begin("XuanYuFuZhu",  ref checkBoxValue);

		string chineseText = "这里显示中文";
		ImGui.Text(chineseText);


		if (!showWindow)
		{
			System.Environment.Exit(0);
		}
	}


	public void CloseWindowAndExit()
	{
		showWindow = false;
	}

	public static void Main(string[] args)
	{
		Program program = new Program();
		program.Start().Wait();
	}
}

}

@HuaChenDu
Copy link
Author

You need to do something like what is described here: #67

Uploading 屏幕截图 2024-04-24 164844.png…
Thank you very much for your help. After 2 days of trial and error, I added this line 'ImGui.CreateContext();' on top of the method you provided, and now it can display Chinese characters.

@abo-nb
Copy link

abo-nb commented May 4, 2024

Can you provide the code? Thanks!

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

No branches or pull requests

3 participants