Expand description
§textcode
§Intro
textcode is a library for text encoding/decoding. Supports next charsets:
UTF-8UTF-16BE- UTF-16 Big EndianUTF-16LE- UTF-16 Little Endianiso-6937- Latin superset of ISO/IEC 6937 with addition of the Euro symboliso-8859-1- Western Europeaniso-8859-2- Central Europeaniso-8859-3- South Europeaniso-8859-4- North Europeaniso-8859-5- Cyrilliciso-8859-6- Arabiciso-8859-7- Greekiso-8859-8- Hebrewiso-8859-9- Turkishiso-8859-10- Nordiciso-8859-11- Thaiiso-8859-13- Baltic Rimiso-8859-14- Celticiso-8859-15- Western Europeaniso-8859-16- South-Eastern Europeangb2312- Simplified Chinese
§Usage
use textcode::{Iso8859_5, decode, encode};
let text = decode::<Iso8859_5>(b"\xbf\xe0\xd8\xd2\xd5\xe2!");
assert_eq!(text, "Привет!");
let bytes = encode::<Iso8859_5>("Привет!");
assert_eq!(bytes, b"\xbf\xe0\xd8\xd2\xd5\xe2!");Modules§
- dvb
- DVB text decoding module.
Structs§
- Gb2312
- Simplified Chinese encoding.
- Geo
- Iso6937
- Latin superset of ISO/IEC 6937 with addition of the Euro symbol.
- Iso8859_
1 - ISO-8859 encoding implementation.
- Iso8859_
2 - ISO-8859 encoding implementation.
- Iso8859_
3 - ISO-8859 encoding implementation.
- Iso8859_
4 - ISO-8859 encoding implementation.
- Iso8859_
5 - ISO-8859 encoding implementation.
- Iso8859_
6 - ISO-8859 encoding implementation.
- Iso8859_
7 - ISO-8859 encoding implementation.
- Iso8859_
8 - ISO-8859 encoding implementation.
- Iso8859_
9 - ISO-8859 encoding implementation.
- Iso8859_
10 - ISO-8859 encoding implementation.
- Iso8859_
11 - ISO-8859 encoding implementation.
- Iso8859_
13 - ISO-8859 encoding implementation.
- Iso8859_
14 - ISO-8859 encoding implementation.
- Iso8859_
15 - ISO-8859 encoding implementation.
- Iso8859_
16 - ISO-8859 encoding implementation.
- Utf8
- UTF-8 encoding.
- Utf16
Traits§
- Textcode
- Trait for text encoding/decoding implementations.
Functions§
- decode
- Decodes bytes from the source encoding to a UTF-8 String.
- decode_
to_ slice - Decodes bytes from the source encoding to a UTF-8 slice. Returns the number of bytes written.
- encode
- Encodes UTF-8 string to the target encoding.
- encode_
to_ slice - Encodes UTF-8 string to the target encoding slice. Returns the number of bytes written.