commit | d1af1742dc7b72ecbd25da5d8fd3e74aacccea7f | [log] [tgz] |
---|---|---|
author | Scott Lobdell <slobdell@google.com> | Sun Jan 30 02:48:17 2022 +0000 |
committer | Scott Lobdell <slobdell@google.com> | Sun Jan 30 03:04:19 2022 +0000 |
tree | ca9ba939281ce1cdb13491031e734ceb300d9940 | |
parent | 887c3f70d15d09d6eac3a734a57913d233eaa7bf [diff] | |
parent | 8c6ebbd07f71b0e4ee600fb8fb6aa4dd8646a604 [diff] |
Merge TP1A.220107.002 Change-Id: Iec60211ce479e2bcac9e184c9e243f2c231d6e10
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.