| commit | 3ded08933a3aa53c1ea8095c1294922073df21de | [log] [tgz] |
|---|---|---|
| author | Android Build Coastguard Worker <[email protected]> | Fri Mar 10 04:19:44 2023 +0000 |
| committer | Automerger Merge Worker <[email protected]> | Fri Mar 10 04:19:44 2023 +0000 |
| tree | 87b5f7bf87edcd74f46de24857666715bfcae5c7 | |
| parent | c537c01f4a7319771e2fccecf1a0d7255bd530be [diff] | |
| parent | 9f53880ebcdbd160d8531cfac7fa21621dd66455 [diff] |
Snap for 9719949 from bf620bb5f2fbd519dc45100da7edcd62db4b756f to udc-release am: 9f53880ebc Original change: https://googleplex-android-review.googlesource.com/c/platform/external/rust/crates/cesu8/+/21946469 Change-Id: If0e938cab420e4695984e635dc064385ac20b00c Signed-off-by: Automerger Merge Worker <[email protected]>
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.