You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The encoding of GetClipboardString method in Glfw is not correct, it should be LPUTF8Str.
Steps to reproduce
Platform: Desktop (Windows 11 in Simplified Chinese)
Framework Version: .NET 9
Package: Silk.NET.Input.Glfw version 2.22.0
API: /
API Version: /
Copy a Chinese character, then run Console.WriteLine(inputContext.Keyboards[0].ClipboardText), the output is wrong.
For example, I copy 你, the output will be 浣?
Then I run Encoding.GetEncoding("gb2312").GetString(Encoding.UTF8.GetBytes("你")), the result is 浣? too. (gb2312 is the default encoding of my system.)
I set a breakpoint in SilkMarshal.PtrToString method and run Utf8PtrToString(input), I get the correct character 你.
Comments
In the document of GLFW:
const char* glfwGetClipboardString ( GLFWwindow * window )
This function returns the contents of the system clipboard, if it contains or is convertible to a UTF-8 encoded string.
So we have to use UTF-8 too.
If you know how to fix this issue, please submit a pull request instead!
The code of GetClipboardString seems autogenerated, I don't know how to fix it.
The text was updated successfully, but these errors were encountered:
Summary
The encoding of GetClipboardString method in Glfw is not correct, it should be LPUTF8Str.
Steps to reproduce
Console.WriteLine(inputContext.Keyboards[0].ClipboardText)
, the output is wrong.你
, the output will be浣?
Encoding.GetEncoding("gb2312").GetString(Encoding.UTF8.GetBytes("你"))
, the result is浣?
too. (gb2312 is the default encoding of my system.)SilkMarshal.PtrToString
method and runUtf8PtrToString(input)
, I get the correct character你
.Comments
In the document of GLFW:
So we have to use UTF-8 too.
If you know how to fix this issue, please submit a pull request instead!
The code of GetClipboardString seems autogenerated, I don't know how to fix it.
The text was updated successfully, but these errors were encountered: