commit | 28b7f207da6c391da11d45088ee0a892298febff | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue May 21 23:12:22 2024 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue May 21 23:12:22 2024 +0000 |
tree | 6255c47cec13d6aa49c64d1866f596e630003109 | |
parent | dc094ce394ecbfa0ac7b6d1cfc5979cb615a3914 [diff] | |
parent | 95fc8cc581f1d8de7529c4dd821cb24b4aae9aee [diff] |
Snap for 11869550 from 95fc8cc581f1d8de7529c4dd821cb24b4aae9aee to 24Q3-release Change-Id: I7f8b47d9a9c9661e65712d40efb423c300f7ac3c
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.