commit | 887c3f70d15d09d6eac3a734a57913d233eaa7bf | [log] [tgz] |
---|---|---|
author | Scott Lobdell <slobdell@google.com> | Fri Jan 21 07:03:27 2022 +0000 |
committer | Scott Lobdell <slobdell@google.com> | Fri Jan 21 07:14:03 2022 +0000 |
tree | 54d6d989f49b2aa65c0ecd205b0ec6b2e8f526e3 | |
parent | a09ad450798145004002d3789f6e3ca55198244d [diff] | |
parent | 5dd14ff1b8ee7f129a2340e73c3674587476e29a [diff] |
Merge TP1A.211206.001 Change-Id: Iafa52f88577e4ce4c5682dce8499472027952f30
Convert between ordinary UTF-8 and CESU-8 encodings.
CESU-8 encodes characters outside the Basic Multilingual Plane as two UTF-16 surrogate chacaters, which are then further re-encoded as invalid, 3-byte UTF-8 characters. This means that 4-byte UTF-8 sequences become 6-byte CESU-8 sequences.
Note that CESU-8 is only intended for internal use within tightly-coupled systems, and not for data interchange.
This encoding is sometimes needed when working with Java, Oracle or MySQL, and when trying to store emoji, hieroglyphs, or other characters on the Supplementary Multilingual Plane or the Supplementary Ideographic Plane.
Some of this code is adapted from Rust's src/libcore/str.rs
file. This code is covered by LICENSE-RUST.txt and copyright by The Rust Project Developers and individual Rust contributors, as described in that file.
The new code in this project is distributed under the same terms.