我想将ISO-8859-2字符集中的字符串转换为UTF-8字符集,但我找不到Dart语言中的任何解决方案.有可能吗?
在dart:convert中没有用于ISO-8859-2的内置转换器.所以你必须实现自己的编解码器.
你可以看一下Latin1Codec的代码来实现一个Latin2Codec.准备好之后,您将能够:
import 'dart:convert';
final LATIN2 = new Latin2Codec();
main() {
List<int> bytesForIso_8859_2 = ...;
List<int> bytesForUTF8 = LATIN2.fuse(UTF8).encode(bytesForIso_8859_2);
}
Run Code Online (Sandbox Code Playgroud)