cesu8

A simple library for converting between CESU-8 and UTF-8.

![Build Status] ![Latest Version]

Documentation

Module documentation with examples.

Usage

This crate is on crates.io and can be used by adding residua-cesu8 to your dependencies in your project's Cargo.toml:

toml [dependencies] residua-cesu8 = "1"

Examples

Basic usage:

```rust use std::borrow::Cow; use cesu8::{fromcesu8, tocesu8};

let str = "Hello, world!"; asserteq!(tocesu8(str), Cow::Borrowed(str.asbytes())); asserteq!(fromcesu8(str.asbytes()), Ok(Cow::Borrowed(str))); ```

When data needs to be encoded or decoded, it functions as one might expect:

```rust use std::borrow::Cow; use cesu8::from_cesu8;

let str = "\u{10400}"; let cesu8data = &[0xED, 0xA0, 0x81, 0xED, 0xB0, 0x80]; let result: Result, cesu8::DecodingError> = fromcesu8(cesu8data); asserteq!(result.unwrap(), Cow::::Owned(String::from(str))); ```

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.