#unicode #UTF-8 #UTF-16

no-std encode_unicode

UTF-8 and UTF-16 character types, iterators and related methods for char, u8 and u16

8 releases

0.3.2 Aug 8, 2018
0.3.1 Jun 16, 2017
0.3.0 Mar 9, 2017
0.2.0 Jul 24, 2016
0.1.3 Apr 7, 2016

#1 in #utf-8

Download history 1471/week @ 2018-07-03 2123/week @ 2018-07-10 1606/week @ 2018-07-17 1590/week @ 2018-07-24 1481/week @ 2018-07-31 1478/week @ 2018-08-07 1889/week @ 2018-08-14 1943/week @ 2018-08-21 1680/week @ 2018-08-28 1538/week @ 2018-09-04 2325/week @ 2018-09-11 2505/week @ 2018-09-18 2178/week @ 2018-09-25

7,466 downloads per month
Used in 101 crates (5 directly)

MIT/Apache

105KB
1.5K SLoC

encode_unicode

UTF-8 and UTF-16 iterators, character types and related methods for char, u8 and u16.

crates.io page

Features

The minimum supported version of Rust is 1.15, older versions might work now but can break with a minor update.

Optional features

  • #![no_std]-mode: There are a few differences:
    • AsciiExt doesn't exist, but is_ascii() is made available as an inherent impl.
    • Error doesn't exist, but description() is made available as an inherent impl.
    • Extend/FromIterator-implementations for String/Vec<u8>/Vec<u16> are missing.
    • There is no io, so Utf8Iterator doesn't implement Read. This feature is enabled by setting default-features=false in Cargo.toml: encode_unicode = {version="0.3", default-features=false}.
  • Integration with the ascii crate: Convert Utf8Char and Utf16Char to and from ascii::AsciiChar.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

History

The original purpose of this crate was to provide standins for the then unstable encode_utf8() and encode_utf16().
The standins were removed in 0.3 when Rust 1.15 stabilized the encode_ methods, but the other stuff I added, such as iterators like those `encode_utf{8,16}() returned for a while, might still be of use.

Dependencies