support non UTF-8 mingw filesystem#1758
Conversation
|
To test this PR, we need an Windows system with a non-UTF8 global encoding (such as GBK) and a test directory containing files with names that exceed the ANSI encoding range |
|
This is neat! |
|
I forget called |
|
@oldergod |
|
I applied this PR's patch successfully, so I wanted to share real-world data since the PR appears stale. We have a Kotlin/Native CLI at work for managing data pipelines and Power BI integrations. Power BI workflows are Windows-native, so we can't avoid the platform - we would also like to avoid having to fallback to the JVM. Before and after from the same machine - Windows 11, portuguese/windows-1252: BEFORE — stock Okio (narrow-char APIs garble UTF-8 paths) AFTER — patched Okio (wide-char APIs handle Unicode) |
|
Weird lint error: |
|
Any idea how we’d create such a file system in GitHub actions? Hmmm |
|
@swankjesse Windows internally uses UTF-16. On Windows, the system code page does not matter as long as paths are handled in Unicode and use wide-character APIs. In practice, we only need to verify that all Okio filesystem operations consistently rely on wide-character APIs throughout the call chain. This is largely a historical compatibility issue. GitHub Actions does not provide container environments configured in such an unusual way. |

@JakeWharton close #1757.
FileSystem.list(): Extracted the core logic into avariantListfunction.unixMain.mingwX64Mainwith wide-character Win32 APIs.FormatMessageAwithFormatMessageWinlastErrorStringto correctly handle wide-character error messages.WindowsPosixVariant: Replaced all narrow-character function calls with their corresponding wide-character versions to ensure full compatibility with the Windows filesystem.