local-encoding

Join the chat at https://gitter.im/bozaro/local-encoding-rs Build Status Crates.io

This repository contains rust library for encoding/decoding string with local charset. It usefull for work with ANSI strings on Windows.

Unfortunately Windows widly use 8-bit character encoding instead UTF-8. This causes a lot of pain.

For example, in Russian version:

To convert between 8-bit and Unicode used Windows have function: MultiByteToWideChar and WideCharToMultiByte.

This library provide simple function to convert between 8-bit and Unicode characters on Windows.

UTF-8 used as 8-bit codepage for non-Windows system.

Rustdoc: https://bozaro.github.io/local-encoding-rs/local_encoding/

Usage

Put this in your Cargo.toml:

toml [dependencies] local-encoding = "*"

For example: ```rust extern crate local_encoding;

use local_encoding::{Encoding, Encoder};

fn main() { println!("Unicode string: {}", Encoding::ANSI.tostring(b"ANSI string").unwrap()); println!("Unicode string: {}", Encoding::OEM.tostring(b"OEM string").unwrap()); } ```