CESU-8

Source: Wikipedia, the free encyclopedia.

The Compatibility Encoding Scheme for UTF-16: 8-Bit (CESU-8) is a variant of

UCS-2
to UTF-8 converter to UTF-16 data.

The encoding of Unicode non-BMP characters works out to 11101101 1010yyyy 10xxxxxx 11101101 1011xxxx 10xxxxxx (yyyy represents the top five bits of the character minus one). The byte values 0xF0—0xF4 will not appear in CESU-8, as they start the 4-byte encodings used by UTF-8.

CESU-8 is not an official part of the Unicode Standard, because Unicode Technical Reports are informative documents only.[2] It should be used exclusively for internal processing and never for external data exchange.

Supporting CESU-8 in

W3C[3][4] and WHATWG[5] HTML standards, as it would present a cross-site scripting vulnerability.[6]

Java's Modified UTF-8 is CESU-8 with a special overlong encoding of the NUL character (U+0000) as the two-byte sequence C0 80.[7]

The

AL32UTF8
" (since Oracle version 9.0).

Examples

Code point U+0045 U+0205 U+10400
Character E ȅ 𐐀
UTF-8 45 C8 85 F0 90 90 80
UTF-16 0045 0205 D801 DC00
CESU-8 45 C8 85 ED A0 81 ED B0 80

References

  1. ^ McGowan, Rick. "Unicode Technical Report #26 - Compatibility Encoding Scheme for UTF-16: 8-Bit (CESU-8)". Unicode Consortium.
  2. ^ "About Unicode Technical Reports - Types of Unicode Technical Reports: UAX, UTS, UTR". Unicode Consortium.
  3. ^ "8.2.2.3. Character encodings". HTML 5.1 Standard. W3C.
  4. ^ "8.2.2.3. Character encodings". HTML 5 Standard. W3C.
  5. ^ "12.2.3.3 Character encodings". HTML Living Standard. WHATWG.
  6. ^ "<meta> - HTML". MDN Web Docs. Mozilla.
  7. ^ "Java SE documentation for Interface java.io.DataInput, subsection on Modified UTF-8". Oracle Corporation. 2015. Retrieved 2021-04-30.

External links

This page is based on the copyrighted Wikipedia article: CESU-8. Articles is available under the CC BY-SA 3.0 license; additional terms may apply.Privacy Policy