Skip to content

Fix handling of non-ASCII file paths on Windows for PNG read/write operations#84

Merged
nhz2 merged 5 commits into
JuliaIO:masterfrom
akchurinda:fix/windows-non-ascii-path-fopen
May 26, 2026
Merged

Fix handling of non-ASCII file paths on Windows for PNG read/write operations#84
nhz2 merged 5 commits into
JuliaIO:masterfrom
akchurinda:fix/windows-non-ascii-path-fopen

Conversation

@akchurinda

@akchurinda akchurinda commented May 23, 2026

Copy link
Copy Markdown
Contributor

Problem
PNGFiles could not reliably read or write PNG files on Windows when the file path contained non-ASCII characters, because the code used fopen instead 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 _wfopen on 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.

Comment thread src/io.jl
Comment thread src/wraphelpers.jl
Co-authored-by: Anshul Singhvi <anshulsinghvi@gmail.com>
Comment thread src/io.jl Outdated
@akchurinda akchurinda force-pushed the fix/windows-non-ascii-path-fopen branch from 5561a83 to 456e70c Compare May 23, 2026 23:44
@nhz2

nhz2 commented May 24, 2026

Copy link
Copy Markdown
Member

Some thing is broken with Windows CI as well:
Windows:

PNGFiles      |  922    922  1m08.0s

Ubuntu:

PNGFiles      | 1839   1839  1m06.0s

For some reason 900 tests are being skipped.

Edit: Fixed by #86

@nhz2 nhz2 merged commit 0f25c51 into JuliaIO:master May 26, 2026
6 checks passed
@akchurinda

Copy link
Copy Markdown
Contributor Author

@asinghvi17 and @nhz2,
Thank you for taking your time on this PR. Happy the PR solved the other two.
When can we expect the new version to be published? It would solve a lot of downstream issues.

@nhz2

nhz2 commented May 26, 2026

Copy link
Copy Markdown
Member

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.

@akchurinda

Copy link
Copy Markdown
Contributor Author

@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.

@nhz2

nhz2 commented May 26, 2026

Copy link
Copy Markdown
Member

I just tested on Windows as well, and it seems to be working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants