commit | 0cf13d8a05e2f63e7ac6697359773ce65b32c809 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Jul 07 04:43:12 2023 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Jul 07 04:43:12 2023 +0000 |
tree | 87b5f7bf87edcd74f46de24857666715bfcae5c7 | |
parent | 9e01c27a0959bb188c699f3e0303c2fe944ee7a9 [diff] | |
parent | a00cc58135f32b35fe5ab3ad7cf9e3e9d722256f [diff] |
Snap for 10453563 from a00cc58135f32b35fe5ab3ad7cf9e3e9d722256f to mainline-adservices-release Change-Id: I740d62031d05feb83d8274955e5b31306699cc1a
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.