Reputation: 2740
I'm printing some text using a thermal printer. Everything works fine, except when I try to print the vertical bar character |
my printer shows Ö
, so I think that the error is in this part:
text=msg.getBytes("UTF8");
But I don't know why; if I'm using the UTF-8 charset, it seems like it should work. What's wrong?
I've tried it with ("UTF-8"), ("UTF8"), ("ISO8859-1"), ("ISO88591"), ("ISO-8859-1"), but the same thing happens with each.
UPDATE
This is what I like to print (In an Android device)
And this is what I'm getting ont he printer
Upvotes: 0
Views: 1789
Reputation: 111379
It looks like your thermal printer is configured to use one of the ancient character encodings where "uncommon" characters - brackets, braces, vertical bar, .... - are replaced by "national characters," for example ä, ö ü and ß in Germany. When the device is set to use these encodings there is no way to output the replaced characters.
Have a look at the user manual for the thermal printer. There must be a way to change the character mapping to standard ASCII. The Linux console for example has the escape code "\033(B"
to return to the usual ASCII encoding.
Upvotes: 2