Skip to content

The encoding of GetClipboardString method in Glfw is not correct. #2412

Open
@XiaofengdiZhu

Description

@XiaofengdiZhu

Summary

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: /
  1. Copy a Chinese character, then run Console.WriteLine(inputContext.Keyboards[0].ClipboardText), the output is wrong.
  2. For example, I copy , the output will be 浣?
  3. Then I run Encoding.GetEncoding("gb2312").GetString(Encoding.UTF8.GetBytes("你")), the result is 浣? too. (gb2312 is the default encoding of my system.)
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy