Skip to content

metadata() fails on Windows with non-UTF-8 system locales (e.g., GBK) in MinGWX64 #1757

@magic-cucumber

Description

@magic-cucumber

The current implementation for MinGWX64 relies on the _stat64 function. This function expects a char* string encoded in the current system's ANSI code page.

However, the Path object in this library is UTF-8 encoded.

When _stat64 receives UTF-8 bytes in a GBK environment, it misinterprets the characters, leading to "File Not Found" errors.

Replace the usage of _stat64 with its wide-character counterpart: _wstat64. The path should be converted from UTF-8 to UTF-16 (Wide String) before being passed to _wstat64. This will ensure full Unicode support regardless of the user's system locale settings.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions