Am Samstag, den 01.08.2020, 20:23 +0900 schrieb Masamichi Hosoda: > >> `stat ()` in msvcrt.dll has a problem with some Unicode file names. > >> So we use `_wstat ()` instead of `stat ()` if msvcrt.dll is used. > >> To use `_wstat ()`, we need a wide string, > >> so we use `MultiByteToWideChar ()` to convert it. > > > > Do you have an example of a file name that should not work? I now have > > three versions from GUB (one with MoveFileExW; one without but with > > wstat; and one without wstat) and all work correctly on a recent > > Windows 10. Does that mean the issue is gone with a recent update? > > The file name that should not work depends on the language of Windows. > If a short file name exceeds 8 bytes + 3 bytes when written in UTF-8, > `stat ()` in msvcrt.dll cause an error. > > In Windows, most files have a short file name > in addition to the normal file name. > The short file names are up to 8 bytes + 3 bytes in length > and are stored in a Windows language-dependent encoding. > > For example, on Japanese Windows, > the short file name `インスト.LY` is stored in CP932 encoding > with 8 bytes + 2 bytes. > If the name is written in UTF-8 encoding, it is 12 bytes + 2 bytes. > So the short file name `インスト.LY` in Japanese Windows should not work. > However, in other languages Windows, it may work. > > If the normal file name, such as `☃.ly`, > cannot be written in CP932, the problem does not occur > because the short file name is given in US-ASCII only.
Thanks for all the explanation, I think I'm slowly starting to understand the problem. I've tried to get short names with special characters, but failed so far (maybe you need a setting for this?). I'm giving up on this for now and will keep the code path with MoveFileExW unless you feel strongly about removing it. Thanks, Jonas
signature.asc
Description: This is a digitally signed message part