Fix handling of non-ASCII file paths on Windows for PNG read/write operations#84
Conversation
Co-authored-by: Anshul Singhvi <anshulsinghvi@gmail.com>
5561a83 to
456e70c
Compare
|
Some thing is broken with Windows CI as well: Ubuntu: For some reason 900 tests are being skipped. Edit: Fixed by #86 |
|
@asinghvi17 and @nhz2, |
|
It would be good to check if Makie still works on Windows in an environment with this version of PNGFiles. Basically running something like: using Pkg
Pkg.activate(;temp=true)
Pkg.develop("PNGFiles")
Pkg.develop("GLMakie")
Pkg.test("GLMakie")I don't have access to Windows right now to test this. |
|
@nhz2 I have asked a person because of whom I prepared this PR and It worked on his Windows machine (his path contains non-ASCII characters). I'll ask him to send me the output of GLMakie test and I'll post it here, unless someone does it first. |
|
I just tested on Windows as well, and it seems to be working. |
Problem
PNGFiles could not reliably read or write PNG files on Windows when the file path contained non-ASCII characters, because the code used
fopeninstead of the wide-character Windows API. That meant paths with accented or otherwise non-ASCII names could fail even though they should be valid on Windows.This issue is causing MakieOrg/Makie.jl#4749.
Changes
The core fix switches the file open calls in io.jl to
_wfopenon Windows so Unicode file paths are handled correctly for both reading and writing. I also added a test in runtests.jl that saves a small PNG into a temporary Unicode-named directory and loads it back to verify round-trip correctness on all platforms.