Android Question stream bytes encoding for Arabic and Hebrew

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Hello
What is the getbytes encoding of writestream to usbserial for Arabic & Hebrew text?
I used utf8 but not work fine!
 

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
After searching & trying all possibilities I got the answer and worked for Arabic & Hebrew Lang:
  • All printers has many encoding formats so one language can come with more than one format.
  • Print test command to see what the default printer codepage, so select the equivalent required Lang codepage.
    • For example: default printer codepage start with ISO- then you should select your Lang codepage that start with ISO- .
    • Test command will print codepage table used by printer, so you can know it
    • In printer codepage table thier is a sequence for each codepage, this sequence should be sent to printer before sending any text to set its codepage, then encode the text with the equivalent codepage "not sequence".
  • But their is a limitation for RTL Languages such as Arabic: Letters are separated & Left sequence ordered! So result will be terrible!
  • The only solution "according my knowledge" is convert receipt to image then send image to printer.
  • Easiest way is using webview to capture image then sending it to printer.
But my problem is this example is not working! for me, any suggestion?

print test with printer defaults:
astreams1.Write(Array As Byte(0x1D, 0x28, 0x41))
Set printer codepage:
astreams1.Write(Array As Byte(0x1B, 0x74, 40))
'set page code arabic
'note: 40 is the sequence number of arabic codepage - it may vary from printer to another
'note: we don't send codepage
send arabic text to printer:
astreams1.Write("مرحبا بكم".GetBytes("ISO-8859-6"))
'we set codepage here
 
Upvote 0
Top