Re: _wstat on Windows (actually stat stuff in general)



2011/9/26 Kean Johnston <kean johnston gmail com>:
> Plus I am
> fairly sure (but not 100%) that MBCS can represent all of the characters
> UTF-16 can (which is what the _wstat function uses).

MBCS is misleadingly named in Microsoft documentation. It is not
always a multibyte encoding. It is a locale-specific encoding that
depends on your localization of Windows and AFAIK is guaranteed to be
ASCII compatible, and in many cases it is actually a single-byte
encoding. On English Windows, this is cp1252 which is almost identical
to iso8859-1. On Polish Windows, this is cp1250. On Chinese Windows
it's probably gb18030. And so on. In many versions, MBCS can only
represent a little more than plain ASCII.

"Funny characters" (e.g. Unicode characters not representable in the
MBCS / locale encoding) are in fact rather common and cause tangible
bugs when using "narrow" Windows APIs (e.g. Inkscape opens all
drawings normally but this one won't open!), while it's rather hard to
pin down a case where the symlink problem you mention would affect the
user. The ordinary user is unlikely to create any symlinks, and I'm
not even sure that _wstat would be called when selecting the linked
file for opening in the file chooser.

Regards, Krzysztof


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