Menu

#2087 COPY (from edit menu) doesn't work correctly.

v3.x
closed-fixed
compyx
None
Windows
x64
2025-03-06
2024-11-07
Zibri
No

try this:
poke (any screen address) , 94 (PI symbol)

then from edit menu select copy.
the clipboard will be empty.

example:
poke 1234,94

Discussion

  • compyx

    compyx - 2024-11-17

    I had an opportunity to test this yesterday, on a Windows 10 machine, and indeed once you put a Pi symbol somewhere on screen pasting the clipboard contents into notepad or LibreOffice Writer fails.

    Notepad doesn't paste anything, nor display any error message, but Writer showed a message (in Dutch) about the contents of the clipboard being in the wrong "indeling", which probably means the Pi symbol was converted to something not understood by the codepage currently in use on that Windows machine.

    Works fine on my Debian machine, the Pi symbol is simply converted to a dot (0x2e). I'll try to look into this the coming week at work, if I can get my hands on a Windows laptop.

     
    • Zibri

      Zibri - 2024-11-17

      it probably happens with any non printable characters.

       
    • Zibri

      Zibri - 2024-11-17
      Post awaiting moderation.
  • compyx

    compyx - 2024-11-19

    It seems something goes wrong when converting from screencodes to PETSCII and then PETSCII to ASCII: when I check the actual value of the Pi symbol I get 0xde, which isn't ASCII, and since Gtk treats all strings as UTF-8, we also get an error message about an invalid UTF-8 codepoint.

    A quick fix would be to check all characters in the text and replace non-ASCII values with a placeholder such as 0x2e (".") before passing the text to gtk_clipboard_set_text(), but the proper solution would be to find out why we get unprintable characters from charset_p_to_ascii() (the function's name implies we get valid ASCII, but alas).

     
  • compyx

    compyx - 2025-03-01

    I've committed a possible fix in r45510, translating any non-ASCII printable characters to "?".

    Even Windows' notepad.exe appears to accept the clipboard content now.

     
    👍
    1
    • Zibri

      Zibri - 2025-03-02

      it seems fine in 45510.

       
    • Querino

      Querino - 2025-03-02

      while playing with this, i noticed the "£" isn't copied properly, it translates to "\"

      but that would be a different bug (if it's one) ... and it goes back to at least v3.2

       
      • compyx

        compyx - 2025-03-04

        What would "£" have to translate to, when using ASCII? Or do we want to translate to UTF8, which I noticed is a longstanding TODO in the code?

         
        • gpz

          gpz - 2025-03-04

          pound should get translated to backslash

           
          • compyx

            compyx - 2025-03-04

            Which it does, at least on my Linux and Windows machines, so what's the bug exactly?

             
  • compyx

    compyx - 2025-03-06
    • status: open --> closed-fixed
    • assigned_to: compyx
     
  • compyx

    compyx - 2025-03-06

    Closing as fixed. Any discussions about pound translating (or not) to '\' can go into a new ticket. Copying/translating non-printable PETSCII codes to something even notepad can handle works now.

     

Log in to post a comment.

MongoDB Logo MongoDB