H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Jan 14, 2021 #1 Hello What is the getbytes encoding of writestream to usbserial for Arabic & Hebrew text? I used utf8 but not work fine!
Hello What is the getbytes encoding of writestream to usbserial for Arabic & Hebrew text? I used utf8 but not work fine!
TILogistic Expert Licensed User Longtime User Jan 14, 2021 #2 HAH said: Hello What is the getbytes encoding of writestream to usbserial for Arabic & Hebrew text? I used utf8 but not work fine! Click to expand... ISO 8859-6 Arabic ISO 8859-8 Hebrew Windows-1255 para Hebrew Windows-1256 para Arabic Upvote 0
HAH said: Hello What is the getbytes encoding of writestream to usbserial for Arabic & Hebrew text? I used utf8 but not work fine! Click to expand... ISO 8859-6 Arabic ISO 8859-8 Hebrew Windows-1255 para Hebrew Windows-1256 para Arabic
Erel B4X founder Staff member Licensed User Longtime User Jan 15, 2021 #3 There are many possible encodings. Upvote 0
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Jan 15, 2021 #4 All of your suggestions tried & failed! I'm try to print on usb printer, English letters going well. Upvote 0
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Jan 17, 2021 #5 Erel said: There are many possible encodings. Click to expand... Can you list some of them that work fine Upvote 0
Erel said: There are many possible encodings. Click to expand... Can you list some of them that work fine
Erel B4X founder Staff member Licensed User Longtime User Jan 17, 2021 #6 Worth reading: https://www.b4x.com/glossary/unicode-utf8/ All of the encodings work fine. It will be easier to help you if you explain the problem. Upvote 0
Worth reading: https://www.b4x.com/glossary/unicode-utf8/ All of the encodings work fine. It will be easier to help you if you explain the problem.
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Jan 18, 2021 #7 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? Code: Copy astreams1.Write(Array As Byte(0x1D, 0x28, 0x41)) Code: Copy 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 Code: Copy astreams1.Write("مرحبا بكم".GetBytes("ISO-8859-6")) 'we set codepage here Upvote 0
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? Code: Copy astreams1.Write(Array As Byte(0x1D, 0x28, 0x41)) Code: Copy 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 Code: Copy astreams1.Write("مرحبا بكم".GetBytes("ISO-8859-6")) 'we set codepage here