On Tue, Jan 23, 2024 at 09:15:30PM +0100, Enrico Forestieri wrote:

On Tue, Jan 23, 2024 at 02:58:37PM -0500, Richard Kimberly Heck wrote:

On 1/23/24 14:51, Enrico Forestieri wrote:
On Mon, Jan 22, 2024 at 06:21:42PM -0500, Richard Kimberly Heck wrote:

The conversion script has:

infile = "C:/Users/Thibaut/Desktop/p k .pdf"

when the input file was: ~\Desktop\píkà.pdf. The accented characters have been stripped. This is not a surprise, though, since toFilesystemEncoding has a comment that says it does not work with non-ASCII characters on Windows. The puzzle is why this worked on 2.3.7. None of this code has changed, so far as I can see.

Note that this might be a red herring. toFilesystemEncoding only encodes file names and not the content of a file that is utf8. The fact that the accented characters seem to have disappeared may simply be due to the fact the terminal on Windows is not able to display utf8 characters.

So, the output should be redirected to a file to be sure.

Can you explain to Didier how to do that on Windows?

This may be impossible because the distributed version of lyx is a gui application and prints nothing to the terminal.

Thibaut said he could reproduce. I'm reattaching his test files and logs. The logs were copied from the Messages pane, he said.

Yes, I get the same mangled name in the message pane:

infile = "C:/work/test/p�k�.pdf"

but everything works fine for me. Seemingly, the problem with the message pane is peculiar to the Windows native version because on cygwin I instead correctly get:

infile = "/c/work/test/píkà.pdf"

However, I don't know why that is so.

After investigating this I now know why. Capturing the generated script in a file reveals that it is actually encoded in a 8 bit encoding on Windows, despite the fact that the first line of the script says it is encoded in utf-8.

It has always been like that, so why it does not work anymore? The answer is that the script works with Python2 but not with Python3.
Trying to run it with Python2 everything works, whereas Python3 gives:
$ /c/Progra~1/LyX/Python/python.exe conv.py
  File "C:\work\test\conv.py", line 11
    infile = "C:/work/test/p�k�.pdf"
                                ^
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xed in position 14: invalid continuation byte

Converting the file to utf-8 encoding everything works fine.

--
Enrico
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to