#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

12 releases

Uses old Rust 2015

0.3.6 Aug 23, 2019
0.3.5 Oct 23, 2018
0.3.2 Aug 8, 2018
0.3.1 Jun 16, 2017
0.1.3 Apr 7, 2016

#127 in Encoding

Download history 53530/week @ 2021-02-24 55307/week @ 2021-03-03 65492/week @ 2021-03-10 58107/week @ 2021-03-17 59558/week @ 2021-03-24 63357/week @ 2021-03-31 65479/week @ 2021-04-07 62440/week @ 2021-04-14 59478/week @ 2021-04-21 62325/week @ 2021-04-28 61988/week @ 2021-05-05 70491/week @ 2021-05-12 69069/week @ 2021-05-19 74483/week @ 2021-05-26 68272/week @ 2021-06-02 66842/week @ 2021-06-09

259,958 downloads per month
Used in 1,181 crates (12 directly)




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

crates.io page


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:
    • 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 and Utf8CharSplitter doesn't implement Read. This feature is enabled by setting default-features=false in Cargo.toml: encode_unicode = {version="0.3.4", default-features=false}.
  • Integration with the ascii crate: Convert Utf8Char and Utf16Char to and from ascii::AsciiChar.


Licensed under either of

at your option.


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.


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.