[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2,21,4 released

From: Masamichi Hosoda
Subject: Re: 2,21,4 released
Date: Sat, 01 Aug 2020 20:23:24 +0900 (JST)

>> `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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]