Unicode 字符串与 .NET 框架默认值比较的示例

发布于 2024-10-03 03:05:22 字数 867 浏览 0 评论 0原文

我正在寻找一些示例,说明聪明人如何以及何时对字符串与框架默认值进行 Unicode 比较。

由于许多人不使用来自其他文化的字符串,因此这里有一些我发现的有趣的比较示例。

  1. .ToUpper()
    • 小写土耳其语“i”转换为大写 ï (U+0130)
  2. 等于
    • 上面土耳其语示例的大写版本
  3. 比较句子中最后一个单词的相等性
    • 希伯来语对句子中最后一个字母的处理方式与阿拉伯语的表示方式不同
  4. ...其他示例...

问题
Unicode 世界中常见的比较有哪些? (随意扩展语言示例)

我应该在什么情况下使用(或不使用)不区分文化的比较?这似乎可以归结为“语言”或“非语言/(二进制)”操作。

  • 这与安全性和检查用户名/密码有何关系。
  • 如何以及何时在语言操作和非语言操作之间进行选择?

我特别感兴趣这将如何影响中文和其他东方语言。

参考文献
在研究这个问题时,我遇到了这些网站

Joel on Software:每个开发人员都应该了解 Unicode

.NET 中的字符串

I'm looking for some examples of how and when smart people do a Unicode comparison of strings, versus the framework default.

Since many people don't work with strings from other cultures, here are a few interesting comparison examples I found.

  1. .ToUpper()
    • The lowercase Turkish 'i' converts to an uppercase İ (U+0130)
  2. Equals
    • The uppercase version of the Turkish example above
  3. Comparing equality for the last word in a sentence
    • Hebrew treats the last letter in a sentence differently then how it would be represented in Arabic
  4. ... other examples ...

Question
What comparisons are common in the Unicode world? (feel free to expand on the language examples)

What situations should I use (or not use) culture insensitive comparisons? This seems to boil down to either a "linguistic", or a "non-linguistic/(binary)" operation.

  • How does this relate to security and checking usernames/passwords.
  • How and when does one choose between linguistic operations and non-linguistic operations?

I'm particularly interested how this would affect Chinese and other eastern languages.

References
While researching this question, I came across these sites

Joel on Software: What every developer should know about Unicode

Strings In .NET

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文