Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1057

Flutter: Arabic language isn't recognizable, it seems like symbols, and want to encode/decode

$
0
0

I have a text wanna show it in pdf file created by Flutter app

The English letters shown ok, but the Arabic has problems with appearing!!!

I used 'dart:convert' package for edcoding/decoding from utf-8, but there is a mistake I didn't know it.

This is the code:

onPress: () async {                  var encoded1 = utf8.encode(firstName);                  var encoded2 = utf8.encode(lastName);                  var decoded1 = utf8.decode(encoded1);                  var decoded2 = utf8.decode(encoded2);                  final data = await controller.createInvoice(                    items: controller.items,                    firstName: encoded1.toString(),                    lastName: decoded2,                    counterNumber: counterNo,                    subType: subType,                    date: controller.date,                  );                  controller.savePdfFile('invoice_5', data);                },

Here in my code, at firstName I used encode, and in the lastName I used decode to see what is the difference, but still have problem with both like what shown in the attached image.

This is the result:enter image description here


Viewing all articles
Browse latest Browse all 1057

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>