Message384012
> "lowercase two strings by means of LCMapStringEx() and then wcscmp
> the two" always gives the same result as "compare the two strings
> with CompareStringOrdinal()"
For checking case-insensitive equality, it shouldn't matter whether names are converted to uppercase or lowercase when using invariant non-linguistic casing. It's based on symmetric mappings between pairs of uppercase and lowercase codes, which avoids problems such as 'ϴ' (U+03F4) and 'Θ' (U+0398) both lowercasing as 'θ' (U+03B8), or 'ß' uppercasing as 'SS'.
That said, when sorting filenames, you need to use LCMAP_UPPERCASE in order to match the case-insensitive sort order of Windows. For example, 'Ÿ' (U+0178) is greater than 'Ŷ' (U+0176), but -- respectively lowercase -- 'ÿ' (U+00FF) is less than 'ŷ' (U+0177). In particular, if you have an NTFS directory with two files named 'ÿ' and 'ŷ', the listing will be ['ŷ', 'ÿ'] -- in uppercase order. (An NTFS directory is stored on disk as a b-tree sorted by uppercase filenames.)
For the implementation, _winapi.LCMapStringEx and related constants could be added. |
|
Date |
User |
Action |
Args |
2020-12-29 15:48:41 | eryksun | set | recipients:
+ eryksun, paul.moore, tim.golden, zach.ware, steve.dower, sogom |
2020-12-29 15:48:41 | eryksun | set | messageid: <1609256921.73.0.993353075096.issue42658@roundup.psfhosted.org> |
2020-12-29 15:48:41 | eryksun | link | issue42658 messages |
2020-12-29 15:48:41 | eryksun | create | |
|