VB.Net unicode支持 [英] VB.Net unicode support

查看:175
本文介绍了VB.Net unicode支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone,



VS2010中的VB.Net是否支持unicode?



任何帮助这方面是贬值的。



问候,

Joy

解决方案

所有版本的.NET都基于Unicode。



它不仅仅支持Unicode。在某种程度上,不直接支持非Unicode字符串/字符。这意味着如果您使用标准字符串 char 类型编写一些.NET应用程序,然后保存数据使用非Unicode 编码之一(例如ASCII),它不保证数据保存而不会丢失,除非您特别注意它。之所以会发生这种情况是因为默认情况下,您的用户不会受到ASCII的字符集的限制,并且始终能够输入代码点的某些Unicode字符。不能用ASCII表示。 (ASCII仅是示例。)这样的字符将全部由'?'表示,这当然意味着数据的丢失。



因此,它是建议任何.NET应用程序(甚至是控制台应用程序)都应该在假设可以从Unicode指令集的任何部分输入文本数据的情况下编写。并且您不应该尝试支持非UTF编码,但不包括一些特殊情况,例如处理编码或分析文本和编码的实用程序。



internally在内存表示中,.NET使用UTF-16LE形式的Unicode字符表示,但这个事实永远不应该直接用于编程。字符/字符串数据应被视为抽象Unicode数据,从其内存表示中抽象出来。用于获取特定的UTF数据(表示为 byte [] 数组)序列化基于 System.Text.Encoding 应该使用类: http ://msdn.microsoft.com/en-us/library/system.text.encoding%28v=vs.110%29.aspx [ ^ ]。

<一些阅读:

http://en.wikipedia.org/wiki/ Unicode [ ^ ],

http://www.unicode.org/ [ ^ ],

http:/ /en.wikipedia.org/wiki/Unicode_Transformation_Format [<一个href =http://en.wikipedia.org/wiki/Unicode_Transformation_Formattarget =_ blanktitle =New Window> ^ ],

http://www.unicode.org/faq/utf_bom.html [ ^ ]。



-SA

Hello Everyone,

Does VB.Net in VS2010 support unicode?

Any help in this regard would be apreciated.

Regards,
Joy

解决方案

All version of .NET are based on Unicode.

It's more than just supporting Unicode. In a way, non-Unicode strings/characters are not directly supported. It means that if you write some .NET application with the use of standard string and char types, and then save data using one of the non-Unicode encodings (such as ASCII), it won't guarantee that the data is saved without loss, unless you take a special care about it. It can happen because your user, by default, won't be limited by the character repertoire of ASCII, and will always be able to enter some Unicode characters of the code points which cannot be represented in ASCII. (ASCII is only the example.) Such character will all be automatically represented by '?', which of course will mean the loss of data.

Therefore, it is recommended that any .NET application (even a console application) should be written in assumption that the text data can be entered from any part of Unicode repertoire. And you should not try to support non-UTF encodings, with the exclusion of some special cases, such as utilities dealing with encoding or analyzing texts and the encodings.

Internally, in memory representation, .NET uses the representation of Unicode characters in the form of UTF-16LE, but this fact should never be directly used in programming. The character/string data should be considered as abstract Unicode data, abstracted from its memory representation. For getting particular UTF data (represented as the byte[] array) serialization based on the System.Text.Encoding classes should be used: http://msdn.microsoft.com/en-us/library/system.text.encoding%28v=vs.110%29.aspx[^].

Some reading:
http://en.wikipedia.org/wiki/Unicode[^],
http://www.unicode.org/[^],
http://en.wikipedia.org/wiki/Unicode_Transformation_Format[^],
http://www.unicode.org/faq/utf_bom.html[^].

—SA


这篇关于VB.Net unicode支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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