diff --git a/CHANGELOG.md b/CHANGELOG.md index bea1e80..1a4c210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,3 +11,5 @@ Working on iOS and Android ## 1.0.1 Change dependency of device_info to device_info_plus +## 1.0.2 +Fixed encode issue with special characters diff --git a/lib/helpers/bytes_utils.dart b/lib/helpers/bytes_utils.dart index 027accf..b8d67d3 100644 --- a/lib/helpers/bytes_utils.dart +++ b/lib/helpers/bytes_utils.dart @@ -37,12 +37,13 @@ abstract class BytesUtils { Uint8List.fromList(value).buffer.asByteData().getInt8(0); static Uint8List stringToBytesArray(String value) => - Uint8List.fromList(value.codeUnits); + Uint8List.fromList(utf8.encode(value)); static int getInt64(List value) => Uint8List.fromList(value).buffer.asByteData().getInt64(0, Endian.host); - static String getString(List value) => utf8.decode(value); + static String getString(List value) => + utf8.decode(value, allowMalformed: true); static List getBytesRangeAsIntList( Uint8List bytesList, int start, int bytesAmount) { diff --git a/pubspec.yaml b/pubspec.yaml index e8c7a6a..f595bd3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: nearby_cross description: Flutter plugin for Android and iOS to use Nearby Connections API and send messages between devices. -version: 1.0.1 +version: 1.0.2 repository: https://github.com/IgVelasco/nearby_cross environment: