charset_converter 0.0.1 charset_converter: ^0.0.1 copied to clipboard
Platform charset converter
Charset converter #
Encode and decode charsets using platform built-in converter. This saves app package size as you don't need any external charset maps or whole libraries like iconv. This package doesn't even contain any Dart dependencies. However this comes with the dependency on the platform.
Still package was originally made to help deal with this StackOverflow question and Dart's lack of support for many specific charset like GBK, Big5, Windows-125X or ISO-8859-XX.
Usage #
Encoding
Uint8List encoded = await CharsetConverter.encode("windows1250", "Polish has óśćł");
Decoding
String decoded = await CharsetConverter.decode("windows1250",
Uint8List.fromList([0x43, 0x7A, 0x65, 0x9C, 0xE6])); // Hello (Cześć) in Polish
Getting list of available charsets
Helpful if you don't know exact name of the charset.
List<String> charsets = await CharsetConverter.availableCharsets();
What's coming #
- iOS support
- Stream API
How does it work? #
Android comes with Java runtime, which has a built-in Charset class which has convenient encode
and decode
methods. All it's left to do is use channels to pass the data.
Contributing #
Feel free to create issues, fix bugs, add new functionalities even if you are not sure about. Everyone is welcome!