commit | aa60c62eb45568d4a6cca4ee03bc1bfb0cf7499a | [log] [tgz] |
---|---|---|
author | Xin Li <delphij@google.com> | Wed Nov 17 20:21:22 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Nov 17 20:21:22 2021 +0000 |
tree | 54d6d989f49b2aa65c0ecd205b0ec6b2e8f526e3 | |
parent | c8a5013ec748bb9e22e15b98b6e0c28c35d3ac21 [diff] | |
parent | a5cd12057c4cb62da89725ed9d356cadc5599443 [diff] |
[automerger skipped] Merge sc-qpr1-dev-plus-aosp-without-vendor@7810918 am: 0e2b1f567b -s ours am: cb23c5e5c5 -s ours am: a5cd12057c -s ours am skip reason: Merged-In I166d733de00510939beec80a912a06516c731e37 with SHA-1 4805e42b92 is already in history Original change: https://googleplex-android-review.googlesource.com/c/platform/external/rust/crates/cesu8/+/16276239 Change-Id: I053ba48240866a154bddb0421af15a43d1f822eb
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.