Popularity of text encodings explained

A number of text encoding standards have historically been used on the World Wide Web, though by now UTF-8 dominant in all countries, and the few major regional exceptions listed below. The same encodings are used in local files (or databases), in fact many more, at least historically. Exact measurements for the prevalence of each are not possible, because of privacy reasons (e.g. for local files, not web accessible), but rather accurate estimates are available for public web sites, and statistics may (or may not accurately) reflect use in local files. Attempts at measuring encoding popularity may utilize counts of numbers of (web) documents, or counts weighed by actual use or visibility of those documents.

The decision to use any one encoding may depend on the language used for the documents, or the locale that is the source of the document, or the purpose of the document. Text may be ambiguous as to what encoding it is in, for instance pure ASCII text is valid ASCII or ISO-8859-1 or CP1252 or UTF-8. "Tags" may indicate a document encoding, but when this is incorrect this may be silently corrected by display software (for instance the HTML spec says that the tag for ISO-8859-1 should be treated as CP1252), so counts of tags may not be accurate.

Popularity on the World Wide Web

UTF-8 has been the most common encoding for the World Wide Web since 2008.[1], UTF-8 is used by 98.2% of surveyed web sites (and 99.1% of top 100,000 pages and 98.6% of the top 1,000 highest-ranked web pages), the next most popular encoding, ISO-8859-1, is used by 1.2% (and only 12 of the top 1,000 pages).[2] Although many pages only use ASCII characters to display content, very few websites now declare their encoding to only be ASCII instead of UTF-8.[3]

Virtually all countries and over 97% all of the tracked languages have 95% or more use of UTF-8 encodings on the web. See below for the major alternative encodings:

The second-most popular encoding varies depending on locale, and is typically more efficient for the associated language. One such encoding is the Chinese GB 18030 standard, which is a full Unicode Transformation Format, still 96.0% of websites in China and territories use UTF-8[4] [5] [6] with it (effectively[7]

Notes and References

  1. Web site: Mark . Davis . Mark Davis (Unicode) . 2008-05-05. Moving to Unicode 5.1 . 2023-03-13 . Official Google Blog . en.
  2. Web site: Usage Survey of Character Encodings broken down by Ranking. W3Techs. en. 2024-07-03.
  3. Web site: Usage statistics and market share of ASCII for websites, January 2024 . W3Techs . 2024-01-13.
  4. Web site: Distribution of Character Encodings among websites that use China and territories . 2024-08-11 . w3techs.com.
  5. Web site: Distribution of Character Encodings among websites that use .cn. w3techs.com. 2021-11-01.
  6. Web site: Distribution of Character Encodings among websites that use Chinese. w3techs.com. 2021-11-01.
  7. Web site: Distribution of Character Encodings among websites that use Taiwan . 2024-08-11 . w3techs.com.
  8. Web site: Distribution of Character Encodings among websites that use .ru. w3techs.com. 2024-08-11.
  9. Web site: Distribution of Character Encodings among websites that use Greek. 2024-01-01. w3techs.com.
  10. Web site: Distribution of Character Encodings among websites that use Hebrew. 2024-02-02. w3techs.com.
  11. Web site: Historical trends in the usage of character encodings. 2024-07-03.
  12. Web site: UTF-8 Usage Statistics . BuiltWith . 2011-03-28.
  13. Web site: Usage Report of UTF-8 broken down by Content Languages. w3techs.com. 2024-05-22.
  14. Web site: ХҮМҮҮН БИЧИГ . Human papers . Montsame News Agency . 2022-10-26 . khumuunbichig.montsame.mn . Mongolian.
  15. Web site: Distribution of Character Encodings among websites that use Sign Languages. w3techs.com. en. 2018-12-03.
  16. Web site: Charset. Android note: The Android platform default is always UTF-8.. 2021-01-02. Android Developers. en.
  17. Web site: Galloway. Matt. Character encoding for iOS developers. Or UTF-8 what now?. in reality, you usually just assume UTF-8 since that is by far the most common encoding.. 2021-01-02. www.galloway.me.uk. 9 October 2012 . en.
  18. Web site: UTF-8 - ICU User Guide. userguide.icu-project.org. 2018-04-03.
  19. Web site:
    1. 13311 (change illegal-UTF-8 handling to Unicode "best practice")
    . bugs.icu-project.org. 2018-04-03.
  20. Web site: The Go Programming Language Specification. 2021-02-10.
  21. Web site: Tsai. Michael J.. Michael Tsai - Blog - UTF-8 String in Swift 5. 2021-03-15. en.
  22. Web site: Mattip. 2019-03-24. PyPy Status Blog: PyPy v7.1 released; now uses utf-8 internally for unicode strings. 2020-11-21. PyPy Status Blog.
  23. Web site: PEP 623 -- Remove wstr from Unicode. Until we drop legacy Unicode object, it is very hard to try other Unicode implementation like UTF-8 based implementation in PyPy. . 2020-11-21. Python.org. en.
  24. Web site: Use the Windows UTF-8 code page. 2020-06-06. UWP applications. docs.microsoft.com. en-us.
  25. The Chinese standard and with its extension GBK (which are both interpreted by web browsers as GB 18030, having support for the same letters aUTF]] encoding meant for traditional Chinese characters (though GB 18030 works for those too, is a full UTF), and is next-most popular in Taiwan after UTF-8 at 96.7%, and it's also second-most used in Hong Kong, while there as elsewhere, UTF-8 is even more dominant at 98.2%.[7] The single-byte Windows-1251 is twice as efficient for the Cyrillic script and still 95.3% of Russian websites use UTF-8[8] (however e.g. Greek and Hebrew encodings are also twice as efficient, and UTF-8 has over 99% use for those languages).[9] [10] Japanese and Korean language websites also have relatively high non-UTF-8 use compared to most other countries, with Japanese UTF-8 use at 95.0% followed by the legacy Shift JIS (actually decoded as its superset Windows-31J encoding) and then EUC-JP encoding.[11] [12] South Korea has 95.5% UTF-8 use, with the rest of websites mainly using EUC-KR which is more efficient for Korean text.

    With the exception of GB 18030 (and UTF-16 and UTF-8), other (legacy) encodings do not support all Unicode characters, since they were designed for specific languages.

    , Limburgan (Limburgish) has the lowest UTF-8 use on the web of any tracked language, with 86% use.[13] Well over a third of the languages tracked have 100.0% use of UTF-8 on the web, such as Vietnamese, Marathi, Telugu, Tamil, Javanese, Pañjābī/Punjabi, Gujarati, Farsi/Persian, Hausa, Pashto, Kannada, Lao, Kurdish languages, Tagalog, Somali, Khmer/Cambodian, isiZulu/Zulu, Turkmen (Cyrillic, and Latin-based script since end of the Soviet Union; Arabic-based can also be used.), Tajik (has its own Cyrillic-based script, and Hebrew script used by some, plus 2 other scripts historically), and a lot of the languages with the fewest speakers (often with their own scripts) such as, Armenian, Mongolian (which has a top-to-bottom script[14] plus Cyrillic-based script also used, and more historically), Maldivian (Thaana), Greenlandic (Kalaallisut) and also sign languages.[15]

    Popularity for local text files

    Local storage on computers has considerably more use of "legacy" single-byte encodings than on the web. Attempts to update to UTF-8 have been blocked by editors that do not display or write UTF-8 unless the first character in a file is a byte order mark, making it impossible for other software to use UTF-8 without being rewritten to ignore the byte order mark on input and add it on output. UTF-16 files are also fairly common on Windows, but not in other systems.[16] [17]

    Popularity internally in software

    In the memory of a computer program, usage of UTF-16 is very common, particularly in Windows but and also in JavaScript, Qt, and many other cross-platform software libraries. Compatibility with the Windows API is a major reason for this.

    At one time it was believed by many (and is still believed today by some) that having fixed-size code units offers computational advantages, which led many systems, in particular Windows, to use the fixed-size UCS-2 with two bytes per character. This is false: strings are almost never randomly accessed, and sequential access is the same speed. In addition, even UCS-2 was not "fixed size" if combining characters are considered, and when Unicode exceeded 65536 code points it had to be replaced with the non-fixed-sized UTF-16 anyway.

    Recently it has become clear that the overhead of translating from/to UTF-8 on input and output, and dealing with potential encoding errors in the input UTF-8, vastly overwhelms any savings UTF-16 could offer. So newer software systems are starting to use UTF-8. International Components for Unicode (ICU) has historically only used UTF-16, and still does only for Java, while it now supports UTF-8 (for C/C++ and other languages indirectly), e.g. used that way by Microsoft; supported as the "Default Charset"[18] including the correct handling of "illegal UTF-8".[19] The default string primitive used in newer programing languages, such as Go,[20] Julia, Rust and Swift 5,[21] assume UTF-8 encoding. PyPy is also using UTF-8 for its strings,[22] and Python is looking into storing all strings with UTF-8.[23] Microsoft now recommends the use of UTF-8 for applications using the Windows API, while continuing to maintain a legacy "Unicode" (meaning UTF-16) interface.[24]

    References