What character encoding should I use for a web page containing mostly Arabic text? Is utf-8 okay?

前端 未结 5 937
孤独总比滥情好
孤独总比滥情好 2020-11-28 13:55

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

Is utf-8 okay?

5条回答
  •  失恋的感觉
    2020-11-28 14:30

    UTF-8 is the simplest way to go since it will work with almost everything:

    UTF-8 can encode any Unicode character. Files in different languages can be displayed correctly without having to choose the correct code page or font. For instance Chinese and Arabic can be in the same text without special codes inserted to switch the encoding. (via wikipedia)

    Of course keep in mind that:

    UTF-8 often takes more space than an encoding made for one or a few languages. Latin letters with diacritics and characters from other alphabetic scripts typically take one byte per character in the appropriate multi-byte encoding but take two in UTF-8. East Asian scripts generally have two bytes per character in their multi-byte encodings yet take three bytes per character in UTF-8.

    ... but in most cases it's not a big issues. It would become one if you start handling huge documents.

提交回复
热议问题