Convert string from ISO-8859-2 to UTF-8 in Dart

I would like to convert a string from the ISO-8859-2 character set to a UTF-8 character set, but I cannot find any solution in the Dart language. Can this be done?

+4
source share
1 answer

There is no built-in converter for ISO-8859-2 to dart: convert . Therefore, you must implement your own codec .

You can see the Latin1Codec code for implementation Latin2Codec. When you are ready, you will be able to:

import 'dart:convert';

final LATIN2 = new Latin2Codec();

main() {
  List<int> bytesForIso_8859_2 = ...;
  List<int> bytesForUTF8 = LATIN2.fuse(UTF8).encode(bytesForIso_8859_2);
}
+5
source

All Articles