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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
it probably happens with any non printable characters.
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 fromcharset_p_to_ascii()(the function's name implies we get valid ASCII, but alas).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.
it seems fine in 45510.
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
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?
pound should get translated to backslash
Which it does, at least on my Linux and Windows machines, so what's the bug exactly?
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.