Repository navigation
UTF-8 paths through the wide Win32 calls - #1
Merged
Merged
Conversation
The Windows backend used the narrow (A) calls, which read and return names in the system code page: 'Antônio' came back as the single byte 0xF4, names outside the code page came back as '?', and fs.watch replaced every non-ASCII character with '?'. Every path now crosses MultiByteToWideChar/WideCharToMultiByte with CP_UTF8 and uses the W calls, and junction targets are encoded from the wide GetFullPathNameW result. Loading the backend also sets the Universal CRT's LC_CTYPE to .UTF8 so io.open, os.rename and fopen in native modules accept the same UTF-8 paths.
Contributor
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So basically the Windows backend simply does not take into consideration of any characters outside lde's current codepage. The issue is though, you can't really set a process' codepage neatly without using an application manifest and that's a fairly wide-scoped change that would need to be done in lde itself.
So to make things simpler, this just manually uses
MultiByteToWideCharandWideCharToMultiBytewhich letsfschoose the codepage to work in per Win32 API call instead of forcing it on the lde process which may have unintended side effects. Again, the true solution would be adding Windows application manifests to lde but that's a far bigger change than this.