UTF-8或UTF-16或UTF-32或UCS-2 [英] UTF-8 or UTF-16 or UTF-32 or UCS-2

查看:191
本文介绍了UTF-8或UTF-16或UTF-32或UCS-2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设计一个新的CMS,但要设计,它适合喜欢多语言的内容,所以我想的Uni code我所有的未来需求(UTF-8)是最好的解决方案。

I am designing a new CMS but want to design it to fit all my future needs like Multilingual content so i was thinking Unicode (UTF-8) is the best solution

但随着一些搜索我得到这个文章

But with some search i got this article

<一个href=\"http://msdn.microsoft.com/en-us/library/bb330962%28SQL.90%29.aspx#intlftrql2005_topic2\">http://msdn.microsoft.com/en-us/library/bb330962%28SQL.90%29.aspx#intlftrql2005_topic2

所以,我现在感到困惑,现在用什么 UTF-8 / UTF-16 / UTF-32 / UCS-2 <​​/ STRONG>

So i am now confused what to use now UTF-8 / UTF-16 / UTF-32 / UCS-2

这是多语言内容和性能等更好。

which is better for Multilingual content and performance etc.

PS:我使用Asp.net和C#和SqlServer 2005

在此先感谢

推荐答案

这是一个非的问题,因为你说:

This is a non-issue because you say:

我使用Asp.net和C#和SqlServer 2005

i am using Asp.net and c# and SqlServer 2005

SqlServer的在某些地方(NTEXT,NVARCHAR NCHAR),并在几个XML为中心的地方UTF-8,没有你做什么奇怪的使用UTF-16。

SqlServer uses UTF-16 in some places (ntext, nvarchar, nchar) and UTF-8 in a few XML-centric places, without you doing anything weird.

C#的所有字符串使用UTF-16,用工具连接code,当涉及到处理那些带给我们到...流和文件

C# uses UTF-16 in all its strings, with tools to encode when it comes to dealing with streams and files that bring us onto...

ASP.NET默认使用UTF-8,和想的时候,它是不是一个好的选择(甚至与亚洲语言,这种语言与事实相结合的文字简洁很难的名称和符号在HTML,CSS,JavaScript中,大部分XML应用程序,你会被发送其他流特殊含义的范围将是U + 0000至U + 007F,使得UTF-16比UTF-8在这个范围内小于与显著优势亚洲语言的纯文本)。

ASP.NET uses UTF-8 by default, and it's hard to think of a time when it isn't a good choice (even with Asian languages, the textual concision of such languages combined with the fact that the names and symbols with special meaning in HTML, CSS, javascript, most XML applications and other streams you will be sending are from the range U+0000 to U+007F, makes the advantage of UTF-16 over UTF-8 in that range less significant than with plain text of Asian languages).

在UTF-16和SqlServer的C#和UTF-8 ASP.NET阅读和写作不通过,会为你做了默认设置之间的交谈,但由于这是一个位,你可以很容易地改变,因此,我的回答是使用UTF-8。真的是你将要使用的-8和-16混合物,但你不会注意到大部分时间(你有没有注意到,你已经一直在这样做)。

The talking between the UTF-16 of SqlServer and C# and the UTF-8 that ASP.NET does by in reading and writing, is done for you with default settings, but since this is the one bit you can readily change, my answer therefore would be to use UTF-8. Really you'll be using a mixture of -8 and -16, but you won't notice most of the time (have you noticed that you've already been doing so).

SQL Server是少了几分宽容,如果仅仅因为很多过时的例子有文字预期正在实施的varchar,文本或字符域食用。单纯使用这些为codeS(例如,所有的ISO国家codeS是焦炭的范围(2),这样的nchar(2)将只是浪费空间),只有NVARCHAR,NTEXT和NCHAR的事情的人,而不是机器将读取和写入。

SQL Server is a bit less forgiving, if only because a lot of outdated examples have text expected for human consumption being put in varchar, text or char fields. Use these purely for codes (e.g. all ISO country codes are in the range of char(2), so nchar(2) would just waste space), and only nvarchar, ntext and nchar for things people rather than machines will read and write.

这篇关于UTF-8或UTF-16或UTF-32或UCS-2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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