Android Question Printing Greek characters on a POS printer

thanos

Member
Licensed User
Longtime User
Hello.
I try to print to a thermal pos printer with opening its port (9100) with a socket and send raw text.
Everything is okay with the latin characters.
When I print Greek characters i took bad results.
Instead of the correct characters i took something like ╢│▓╩ etc.
I tried to convert to ISO-8859-1 (which is not totally right because the greek codepage is ISO-8859-7)
B4X:
Dim arrBytes() As Byte  
Dim sText        As String

sText     = "Ημερομηνία"
'- aStream.Write(sText.GetBytes("UTF8"))
arrBytes = sText.GetBytes("ISO-8859-1")
aStream.Write(arrBytes)
but i took almost same results (different characters but bad printing).

I send a question to company support, but no answer...
The client told that with his windows mobile application this printer is able to print greek characters.
For the record the printer is a Custom Kube.
Regards.
 

thanos

Member
Licensed User
Longtime User
All that I can say is that your code is correct. It will send the string with the specified encoding.

Maybe the encoding is not correct.
@Erel
Thanks for the response.
The right encoding for Greek is ISO-8859-7 but i am not wrong this is not supported by Android.
In any case is there a way to convert the strings into an very very old encoding like IBM737 to try?
Regards
 
Upvote 0

thanos

Member
Licensed User
Longtime User
Try it with different charsets. It will throw an error if the charset is not supported.
@Erel
Thanks again.
As i saw the company gives an sdk for Android which is a jar file. Can i use it inside B4A without the necessary xml file?
Regards
 
Last edited:
Upvote 0

thanos

Member
Licensed User
Longtime User
You will need to create a wrapper or access it with JavaObject and #AdditionalJar.
How can i create this wrapper?
And based on your expertise, which way you suggest me?
The wrapper's way or the using the JavaObject (for code readbility, speed etc.)?
Regards
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top