Win32文件名比较 [英] Win32 File Name Comparison

查看:68
本文介绍了Win32文件名比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道Win32在处理不区分大小写的文件名时使用什么区域设置吗?

Does anyone know what culture settings Win32 uses when dealing with case-insensitive files names?

这是否根据用户的区域设置而有所不同?

Is this something that varies based on the user's culture, or are the casing rules that Win32 uses culture invariant?

推荐答案

一个近似的答案是
比较Unicode文件名的正确方法

基本上,建议将两个字符串都大写(使用 CharUpper CharUpperBuff LCMapString ),然后使用二进制比较进行比较(即memcmp或wmemcmp,而不是具有不变语言环境的CompareString)。文件系统不执行Unicode规范化,并且大小写规则不依赖于语言环境设置。

Basically, the recommendation is to uppercase both strings (using CharUpper, CharUpperBuff, or LCMapString), then compare using a binary comparison (i.e. memcmp or wmemcmp, not CompareString with an invariant locale). The file system doesn't do Unicode normalization, and the case rules are not dependent on locale settings.

不幸的是,处理大小写规则已更改的字符时,模棱两可的情况跨不同版本的Unicode,但效果差不多。

There are unfortunate ambiguous cases when dealing with characters whose casing rules have changed across different versions of Unicode, but it's about as good as you can do.

这篇关于Win32文件名比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆