1

I'm very new to ESC Pos printing. Im writing an app which prints receipts, if I try to print an 'ö' I get an '?'. I already set the Codepage to CP437, which should support 'ö' as an character.

In the documentation it explains how I can print special characters, but I just cant get it working: Heres the snippet from the doc.

Edit 1 (code added):

MainActivity.BLUETOOTH_PRINTER.BT_Write(new byte[] {0x1B, 0x52, 0x7});

Using MainActivity.BLUETOOTH_PRINTER_BT_Write() I can print byte[] parts, however printing above code gives me a long page (200 characters) of random stuff.

Heres the full documentation: https://sparkag.com.br/wp-content/uploads/2016/06/ESC_POS-AK912-English-Command-Specifications-V1.4.pdf

T1k33y
  • 17
  • 6
  • "but I just cant get it working": Please show us your code. – vanje Apr 08 '20 at 18:07
  • Is the encoding of the print request string converted to codepage 437? Please try all the characters above 0x80 in codepage 437, not just the characters in the question. – kunif Apr 08 '20 at 23:11
  • Im very unfamiliar with encoding, what would I need to write ```{0x1B, 0x52, 0x80}``` ? – T1k33y Apr 09 '20 at 08:24
  • It is not a printer control command but an encoding of the character string itself to be printed. Currently, there are many articles that convert to utf-8, but is it necessary to convert to cp437 with this? [getBytes](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#getBytes-java.nio.charset.Charset-), [Java String.getBytes( charsetName ) vs String.getBytes ( Charset object )](https://stackoverflow.com/q/23316755/9014308), [String encoding conversion UTF-8 to SHIFT-JIS](https://stackoverflow.com/q/37155417/9014308) – kunif Apr 09 '20 at 12:39

1 Answers1

0

It is probably a special character and needs a "\" to show.

TheXDShrimp
  • 116
  • 13
  • No. I tried adding Javas encoding: ```"\u00F6"```, it still did print an '?'. – T1k33y Apr 08 '20 at 18:45
  • Can you get the special character to appear in you code editor? Because if you can, just use the "\" before it. That should theoretically work. – TheXDShrimp Apr 09 '20 at 02:14