什么是用C#处理Unicode字符串的最佳实践? [英] What are the best practices for handling Unicode strings in C#?

查看:104
本文介绍了什么是用C#处理Unicode字符串的最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以请给我提供了一些重要的方面我应该知道的,而在C#中处理Unicode字符串?

Can somebody please provide me some important aspects I should be aware of while handling Unicode strings in C#?

推荐答案

请在介意C#字符串的字符,UTF-16编码单元sequnces。他们的的Unicode码点。一些Unicode代码点需要两个字符的,你不应该拆分这些个字符之间的串

Keep in mind that C# strings are sequnces of Char, UTF-16 code units. They are not Unicode code-points. Some unicode code points require two Char's, and you should not split strings between these Chars.

此外,Unicode码点可能结合起来,形成一个单一的语言'字符' - - 例如,一个U字符后跟umlat字符。所以,你也不能分割任意代码点之间的字符串。

In addition, unicode code points may combine to form a single language 'character' -- for instance, a 'u' Char followed by umlat Char. So you can't split strings between arbitrary code points either.

基本上,这是问题,在任何给定的问题可能只有在实践影响到你不知道的语言混乱

Basically, it's mess of issues, where any given issue may only in practice affect languages you don't know.

这篇关于什么是用C#处理Unicode字符串的最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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