Crates.io | local-encoding-ng |
lib.rs | local-encoding-ng |
version | 0.1.0 |
source | src |
created_at | 2022-03-11 23:59:23.719691 |
updated_at | 2022-03-11 23:59:23.719691 |
description | A rust library which simplifies the encoding and decoding from the local Windows Ansi codepage. |
homepage | |
repository | https://github.com/tyrylu/local-encoding-rs-ng |
max_upload_size | |
id | 548524 |
size | 20,103 |
This is local-encoding-ng, a library which wastly simplifies dealing with the unfamous Windows 8-bit encodings.
For example, in Russian version:
Windows have functions which help in these conversions:
MultiByteToWideChar
and
WideCharToMultiByte
.
This library provides a simple API for these functions.
Put this in your Cargo.toml
:
[dependencies]
local-encoding-ng = "*"
Or, better, use cargo-edit to add it with a correct version and use it to keep the version up-to-date.
For example:
use local_encoding_ng::{Encoding, Encoder};
fn main()
{
println!("Unicode string: {}", Encoding::ANSI.to_string(b"ANSI string").unwrap());
println!("Unicode string: {}", Encoding::OEM.to_string(b"OEM string").unwrap());
}