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

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

问题描述

有谁知道 Win32 在处理不区分大小写的文件名时使用哪些文化设置?

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

这是根据用户的文化而变化的,还是 Win32 使用文化不变的大小写规则?

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

推荐答案

一个大概的答案是以正确的方式比较 Unicode 文件名.

基本上,建议将两个字符串都大写(使用 CharUpper, CharUpperBuffLCMapString),然后使用二进制比较(即 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天全站免登陆