asio icon indicating copy to clipboard operation
asio copied to clipboard

win_iocp_file_service: ANSI `CreateFileA` is being used instead of `CreateFileW`

Open oo8dev opened this issue 1 year ago • 0 comments

As seen in asio/detail/impl/win_iocp_file_service.cpp:99:

HANDLE handle = ::CreateFileA(path, access, share, 0, disposition, flags, 0);

The ::open method accepts just a plain const char* path without any support for non-ANSI encoding, which prevents opening files with regional, non-ansi-encoded filenames.

Do you think it could be assumed that the path is always coded in UTF-8, and converted via built-in win32 MultiByteToWideChar WideCharToMultiByte functions before opening it? If so, I can do a PR for it @chriskohlhoff .

oo8dev avatar Oct 02 '25 14:10 oo8dev