charset_converter icon indicating copy to clipboard operation
charset_converter copied to clipboard

Error on encoding x-IBM1098 and x-IBM1097

Open sgsm74 opened this issue 2 years ago • 5 comments

When I want to try encode Persian character it show same digit for all characters Uint8List encoded = await CharsetConverter.encode("x-IBM1098", "سلام"); It shows: 127, 127, 127, 127, 127 It's so weird a digit for different character and when I try to decode this numbers It shows some square icon.

sgsm74 avatar Nov 29 '22 06:11 sgsm74

Hmm, I could not find x-IBM1098. What platform do you use?

I check if ISO-8859-6 would work and it seems fine.

pr0gramista avatar Nov 30 '22 14:11 pr0gramista

I saw it on availableCharacterSets and It's the only characterset that works fine with Persian language and It's for Iran System Encoding. Altough the decode function works fine with that. I used it on Android.

sgsm74 avatar Dec 03 '22 05:12 sgsm74

Alright, I'll look into this, but I need to get some Androids first.

If you have any clues why that might happen I'd be happy to learn that. Thanks!

pr0gramista avatar Dec 03 '22 10:12 pr0gramista

I am not sure if this text can be expressed in this encoding and it seems like this encoding returns 127 when it meets a character it can not understand. I was successful with IBM-1256/CP-1256/Windows-1256 for your example text I got bytes 211, 225, 199, 227 where ISO-8859-6 returned 211, 228, 199, 229.

@sgsm74 have you perhaps already solved this issue?

pr0gramista avatar Feb 26 '23 15:02 pr0gramista

Yep, by creating my own class for converting characters. I used it for an inbuilt-printer pos device (citaq) and It was okay

sgsm74 avatar May 21 '23 13:05 sgsm74