HaxeFoundation / HaxeFoundation/neko

Incorrect api used for sys_read_dir on windows

Open
#315 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
587
Forks
110
PR merge metrics
No merged PRs in 30d

Description

On windows, neko uses [`FindFirstFileA` for `sys_read_dir`](https://github.com/HaxeFoundation/neko/blob/c41bdd4f0600680fc23ad6b05bd30e3c398cc6cc/libs/std/sys.c#L527). This returns ANSI encoded strings (not to be confused with ASCII) which means that any non-ascii characters are not compatible with utf8, so they can cause issues when the strings from this function are passed to other places.

We should instead use the `FindFirstFileW` variant which gives utf-16 encoded strings, which can then be converted to valid utf-8.

Similarly, we should replace any use of ANSI variants of the windows api.

This way the behaviour will match non-windows platforms and be more compatible.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in libs/std/sys.c around line 527 and inspect the Windows API calls used by sys_read_dir, then identify other ANSI variants covered by the issue. Done means directory strings and other affected paths handle non-ASCII characters as UTF-8 and match non-Windows behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.