Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

38 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

GitHub CI Linux GitHub CI Windows GitHub CI macOS Crates.io GitHub License Crates.io Downloads dependents Documentation

Encdec

A library for encoding/decoding unicode/utf-8/utf-16(ucs-2) code points.

Examples

Encoding/decoding unicode/UTF-8 code points

let v: Vec<u32> = vec![0x10348 /*...*/]; // Array of unicode code points
let utf8_vec: Vec<u8> = utf8::encode_in_utf8(&v);
utf8::print_utf8_b(&utf8_vec);
let unicode_vec: Vec<u32> = utf8::decode_from_utf8(&utf8_vec);
unicode::print_unicode_b(&v);
--------------- UTF-8 of "๐ˆ" ---------------
Hex: [f0, 90, 8d, 88]
Bin: ["11110000", "10010000", "10001101", "10001000"]
Dec: [240, 144, 141, 136]
--------------------------------------------

--------------- UNICODE of "๐ˆ" ---------------
Hex: [10348]
Bin: ["10000001101001000"]
Dec: [66376]
----------------------------------------------

Encoding/decoding unicode/UTF-16 code points

let v: Vec<u32> = vec![0x10001 /*...*/]; // Array of unicode code points
let utf16_vec: Vec<u16> = utf16::encode_in_utf16(&v);
utf16::print_utf16_b(&utf16_vec);
let unicode_vec: Vec<u32> = utf16::decode_from_utf16(&utf16_vec);
unicode::print_unicode_b(&v);
--------------- UTF-16 of "๐€" ---------------
Hex: [d800, dc01]
Bin: ["1101100000000000", "1101110000000001"]
Dec: [55296, 56321]
---------------------------------------------

--------------- UNICODE of "๐€" ---------------
Hex: [10001]
Bin: ["10000000000000001"]
Dec: [65537]
----------------------------------------------

Contributing

Contributions to this project are welcome! If you have any suggestions, improvements, or bug fixes, feel free to submit a pull request.

License

This repository is licensed under the Apache License 2.0. Please review the license file provided in the repository for more information regarding the terms and conditions of the license.

Contact

If you have any questions, suggestions, or feedback, do not hesitate to contact me.

About

A rust library for encoding/decoding unicode/utf-8/utf-16(ucs-2) code points. ๐Ÿฆ€

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages