pr0gramista / charset_converter

Flutter platform charset converter
BSD 3-Clause "New" or "Revised" License
33 stars 22 forks source link

Support for Windows #15

Closed pr0gramista closed 2 years ago

pr0gramista commented 2 years ago

Closes #13

By far that one was the hardest to implement.

Flutter plugin support for Windows automatically converts Dart's 16-bit code units to 8-bit UTF, therefore before we can encode anything we first need to convert from UTF-8 to wide char or the other way around when we decode.

Windows API doesn't have constants defined for each code page ID therefore I included a map of .NET labels that matches values quite similar to what we can see in iOS or Android. Of course in reality there are code pages that are not included in this map and in cases like that we return a Windows localized name for the code page.

Users may choose a code page either by providing a number (stringified), .NET-like code page name (preferred), or a Windows label.

The PR contains a lot of files, but a lot of them are from regenerating old Android embedding for the example.

pr0gramista commented 2 years ago

Also added a new example app with better tests, which actually exposed a small issue on Android. The result from encoding could contain trailing zeros. Fixed with proper ByteBuffer conversion.

Added Codemagic CI for the whole spectrum of integration tests - Android, iOS and Windows!