cesu8

Convert to and from CESU-8 encoding (similar to UTF-8)

11 releases (2 stable)

Uses old Rust 2015

1.1.0 May 15, 2016
1.0.0 Nov 16, 2015
0.0.9 May 10, 2015
0.0.8 Mar 7, 2015
0.0.4 Dec 26, 2014

#460 in Text processing

Download history 46760/week @ 2022-10-11 51520/week @ 2022-10-18 52720/week @ 2022-10-25 52338/week @ 2022-11-01 55629/week @ 2022-11-08 53299/week @ 2022-11-15 44169/week @ 2022-11-22 56980/week @ 2022-11-29 56084/week @ 2022-12-06 54806/week @ 2022-12-13 45380/week @ 2022-12-20 31182/week @ 2022-12-27 53850/week @ 2023-01-03 61421/week @ 2023-01-10 64216/week @ 2023-01-17 56444/week @ 2023-01-24

240,045 downloads per month
Used in 713 crates (22 directly)

Apache-2.0/MIT

21KB
230 lines

CESU-8 encoder/decoder for Rust

Build Status Latest version License

Documentation.

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.

License

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.

No runtime deps

Features

  • unstable