diff --git a/.github/workflows/tests.yml b/.github/workflows/checks.yml similarity index 97% rename from .github/workflows/tests.yml rename to .github/workflows/checks.yml index a5a4869..3088411 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/checks.yml @@ -1,6 +1,6 @@ # Name of your workflow. -name: "Tests" +name: "Checks" on: push: branches: diff --git a/CHANGELOG.md b/CHANGELOG.md index 96e432c..61c1290 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.2.0 +* Linux support (thanks to [BenderBlog](https://github.com/pr0gramista/charset_converter/pull/38)) + ## 2.1.2 * Fix missing namespace in Android project (thanks to [MemphisNguyen](https://github.com/pr0gramista/charset_converter/pull/36)) diff --git a/README.md b/README.md index e972b58..5b1c8d8 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ iOS can also work with charsets with CoreFoundation CFString functions fe. `CFSt Windows can use [MultiByteToWideChar](https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar) and [WideCharToMultiByte](https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte) from Win32. -Linux can use [libIconv in GLib](https://docs.gtk.org/glib/struct.IConv.html). Since Flutter for Linux use GTK, it is pretty suitable. However, it accept a NUL terminated UTF-8 string (like C string end with`\0`), so in Dart side, String will be dealt by transfering into Uint8List, and add 0 at the end. +Linux can use [libIconv in GLib](https://docs.gtk.org/glib/struct.IConv.html). Since Flutter for Linux use GTK, it is pretty suitable. However, it accept a NUL terminated UTF-8 string (like C string end with`\0`), so in Dart side, String will be dealt by transferring into Uint8List, and add 0 at the end. ## Contributing diff --git a/example/integration_test/app_test.dart b/example/integration_test/app_test.dart index 884589f..2750291 100644 --- a/example/integration_test/app_test.dart +++ b/example/integration_test/app_test.dart @@ -16,8 +16,6 @@ final charsetTestCases = [ ConversionTestCase("Big5", "中文abc", "164, 164, 164, 229, 97, 98, 99"), ConversionTestCase("Big5", "測試", "180, 250, 184, 213"), ConversionTestCase("EUC-KR", "김치", "177, 232, 196, 161"), - ConversionTestCase("windows1250", "Cześć", - "67, 122, 101, 156, 230"), // failed on linux is predictable ConversionTestCase("Windows-1250", "Cześć", "67, 122, 101, 156, 230"), ConversionTestCase("GB2312", "测试", "178, 226, 202, 212"), ConversionTestCase("GBK", "悯农", "195, 245, 197, 169"), diff --git a/example/pubspec.lock b/example/pubspec.lock index 52eeceb..e0d1dcf 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -6,7 +6,7 @@ packages: description: name: async sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.11.0" boolean_selector: @@ -14,7 +14,7 @@ packages: description: name: boolean_selector sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.1" characters: @@ -22,7 +22,7 @@ packages: description: name: characters sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.0" charset_converter: @@ -31,13 +31,13 @@ packages: path: ".." relative: true source: path - version: "2.1.2" + version: "2.2.0" clock: dependency: transitive description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.1" collection: @@ -45,7 +45,7 @@ packages: description: name: collection sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.18.0" cupertino_icons: @@ -53,7 +53,7 @@ packages: description: name: cupertino_icons sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.6" equatable: @@ -61,7 +61,7 @@ packages: description: name: equatable sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.0.5" fake_async: @@ -69,17 +69,17 @@ packages: description: name: fake_async sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.1" file: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" - url: "https://pub.flutter-io.cn" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "6.1.4" flutter: dependency: "direct main" description: flutter @@ -95,7 +95,7 @@ packages: description: name: flutter_lints sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.4" flutter_test: @@ -113,86 +113,62 @@ packages: description: flutter source: sdk version: "0.0.0" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" - url: "https://pub.flutter-io.cn" - source: hosted - version: "10.0.0" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.1" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.1" lints: dependency: transitive description: name: lints sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.1" matcher: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb - url: "https://pub.flutter-io.cn" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" - url: "https://pub.flutter-io.cn" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 - url: "https://pub.flutter-io.cn" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.10.0" path: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" - url: "https://pub.flutter-io.cn" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.8.3" platform: dependency: transitive description: name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" - url: "https://pub.flutter-io.cn" + sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102 + url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.2" process: dependency: transitive description: name: process - sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" - url: "https://pub.flutter-io.cn" + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" source: hosted - version: "5.0.2" + version: "4.2.4" sky_engine: dependency: transitive description: flutter @@ -203,7 +179,7 @@ packages: description: name: source_span sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.10.0" stack_trace: @@ -211,7 +187,7 @@ packages: description: name: stack_trace sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.11.1" stream_channel: @@ -219,7 +195,7 @@ packages: description: name: stream_channel sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.2" string_scanner: @@ -227,7 +203,7 @@ packages: description: name: string_scanner sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.0" super_form: @@ -235,7 +211,7 @@ packages: description: name: super_form sha256: "4de33058b8d2c1e4fd72513785ae9425f589048a6bd20df8a260dec8e5ebd0bf" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.0" sync_http: @@ -243,7 +219,7 @@ packages: description: name: sync_http sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.3.1" term_glyph: @@ -251,7 +227,7 @@ packages: description: name: term_glyph sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: @@ -259,7 +235,7 @@ packages: description: name: test_api sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.6.1" vector_math: @@ -267,25 +243,33 @@ packages: description: name: vector_math sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.4" vm_service: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 - url: "https://pub.flutter-io.cn" + sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 + url: "https://pub.dev" + source: hosted + version: "11.10.0" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "0.3.0" webdriver: dependency: transitive description: name: webdriver - sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e" - url: "https://pub.flutter-io.cn" + sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" + url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.2" sdks: - dart: ">=3.2.0-0 <4.0.0" + dart: ">=3.2.0-194.0.dev <4.0.0" flutter: ">=1.17.0" diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index ad22c7c..4c8b11e 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -18,8 +18,8 @@ void main() { // Verify that platform version is retrieved. expect( find.byWidgetPredicate( - (Widget widget) => widget is Text && - widget.data!.startsWith('Running on:'), + (Widget widget) => + widget is Text && widget.data!.startsWith('Running on:'), ), findsOneWidget, ); diff --git a/lib/charset_converter.dart b/lib/charset_converter.dart index b8066bf..6bb664c 100644 --- a/lib/charset_converter.dart +++ b/lib/charset_converter.dart @@ -18,14 +18,11 @@ class CharsetConverter { /// /// When encoding fails either [CharsetConversionError] or [PlatformException] is thrown. static Future encode(String charset, String data) async { - // ignore: prefer_typing_uninitialized_variables - late final result; + late final Uint8List? result; if (Platform.isLinux) { - /// I know it is silly, but GLib string (gchar *) is the same as C's, - /// the end of the string must be '\0'. - /// - /// I am bad at C, so I have to dealt it in Dart side:P + // A bit silly, but GLib string (gchar *) is the same as C's, the end of the string must be '\0'. + // We are bad at C so we handle it here. result = await _channel.invokeMethod('encode', { "charset": charset, "data": Uint8List.fromList([...utf8.encode(data), 0]), @@ -53,6 +50,8 @@ class CharsetConverter { static Future decode(String charset, Uint8List data) async { final result = await _channel.invokeMethod('decode', { "charset": charset, + // A bit silly, but GLib string (gchar *) is the same as C's, the end of the string must be '\0'. + // We are bad at C so we handle it here. "data": Platform.isLinux ? Uint8List.fromList([...data, 0]) : data, }); diff --git a/pubspec.lock b/pubspec.lock index c6732e2..d994e77 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -6,7 +6,7 @@ packages: description: name: async sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.11.0" boolean_selector: @@ -14,7 +14,7 @@ packages: description: name: boolean_selector sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.1" characters: @@ -22,7 +22,7 @@ packages: description: name: characters sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.0" clock: @@ -30,7 +30,7 @@ packages: description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.1.1" collection: @@ -38,7 +38,7 @@ packages: description: name: collection sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.18.0" fake_async: @@ -46,7 +46,7 @@ packages: description: name: fake_async sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.3.1" flutter: @@ -59,7 +59,7 @@ packages: description: name: flutter_lints sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.0.3" flutter_test: @@ -67,70 +67,46 @@ packages: description: flutter source: sdk version: "0.0.0" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" - url: "https://pub.flutter-io.cn" - source: hosted - version: "10.0.0" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.1" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.1" lints: dependency: transitive description: name: lints sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.1" matcher: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb - url: "https://pub.flutter-io.cn" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" - url: "https://pub.flutter-io.cn" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 - url: "https://pub.flutter-io.cn" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.10.0" path: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" - url: "https://pub.flutter-io.cn" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.8.3" sky_engine: dependency: transitive description: flutter @@ -141,7 +117,7 @@ packages: description: name: source_span sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.10.0" stack_trace: @@ -149,7 +125,7 @@ packages: description: name: stack_trace sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.11.1" stream_channel: @@ -157,7 +133,7 @@ packages: description: name: stream_channel sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.2" string_scanner: @@ -165,7 +141,7 @@ packages: description: name: string_scanner sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.0" term_glyph: @@ -173,7 +149,7 @@ packages: description: name: term_glyph sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: @@ -181,7 +157,7 @@ packages: description: name: test_api sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "0.6.1" vector_math: @@ -189,17 +165,17 @@ packages: description: name: vector_math sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.4" - vm_service: + web: dependency: transitive description: - name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 - url: "https://pub.flutter-io.cn" + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "0.3.0" sdks: - dart: ">=3.2.0-0 <4.0.0" + dart: ">=3.2.0-194.0.dev <4.0.0" flutter: ">=1.17.0" diff --git a/pubspec.yaml b/pubspec.yaml index 9db565f..387bcb4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: charset_converter description: Charset/encoding converter that uses underlying platform - no external dependencies -version: 2.1.2 +version: 2.2.0 homepage: https://github.com/pr0gramista/charset_converter repository: https://github.com/pr0gramista/charset_converter diff --git a/test/charset_converter_test.dart b/test/charset_converter_test.dart index 6935493..042e974 100644 --- a/test/charset_converter_test.dart +++ b/test/charset_converter_test.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:charset_converter/charset_converter.dart'; @@ -11,9 +13,18 @@ void main() { TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler(channel, (MethodCall methodCall) async { if (methodCall.method == "encode") { + if (Platform.isLinux) { + return (methodCall.arguments["data"] as Uint8List).sublist( + 0, (methodCall.arguments["data"] as Uint8List).length - 1); + } return Uint8List.fromList( (methodCall.arguments["data"] as String).codeUnits); } else if (methodCall.method == "decode") { + if (Platform.isLinux) { + return String.fromCharCodes( + (methodCall.arguments["data"] as Uint8List).sublist( + 0, (methodCall.arguments["data"] as Uint8List).length - 1)); + } return String.fromCharCodes(methodCall.arguments["data"]); } else if (methodCall.method == "availableCharsets") { return ["windows1250", "Big5", "GBK"];