我应该使用什么字符编码用于包含大部分阿拉伯文字的网页?是utf-8好吗? [英] What character encoding should I use for a web page containing mostly Arabic text? Is utf-8 okay?

查看:225
本文介绍了我应该使用什么字符编码用于包含大部分阿拉伯文字的网页?是utf-8好吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是utf-8还好吗?

解决方案

UTF-8可以存储完整的Unicode范围,因此可以使用阿拉伯语。




但是,如果您想知道哪种编码最有效: b
$ b

所有阿拉伯字符都可以使用一个UTF-16编码单元进行编码(2字节),但它们可以采用2或3个UTF-8代码单元(每个1字节),所以如果你只是编码阿拉伯语,UTF-16将是一个更节省空间的选择。



然而,你不只是编码阿拉伯文 - 你编码了大量的字符,可以用UTF-8单个字节存储,但UTF-16需要两个字节;所有html编码字符< & > = 以及所有html元素名称。



这是一种折衷,除非你处理与巨大的文件,没关系。


What character encoding should I use for a web page containing mostly Arabic text?

Is utf-8 okay?

解决方案

UTF-8 can store the full Unicode range, so it's fine to use for Arabic.


However, if you were wondering what encoding would be most efficient:

All Arabic characters can be encoded using a single UTF-16 code unit (2 bytes), but they may take either 2 or 3 UTF-8 code units (1 byte each), so if you were just encoding Arabic, UTF-16 would be a more space efficient option.

However, you're not just encoding Arabic - you're encoding a significant number of characters that can be stored in a single byte in UTF-8, but take two bytes in UTF-16; all the html encoding characters <,&,>,= and all the html element names.

It's a trade off and, unless you're dealing with huge documents, it doesn't matter.

这篇关于我应该使用什么字符编码用于包含大部分阿拉伯文字的网页?是utf-8好吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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