1
votes

I'm having trouble printing Chinese characters on receipt using RawPrinterHelper. I am able to print my receipt correctly using PrintDocument but only as XPS and txt.

The string is converted to a byte array which is sent to the RawPrinterHelper. The problem is that one chinese character is equal to 3 bytes. So when it is printed, its displays 3 random characters.

Ex: Chinese character is when converted to byte is {229,164,167} and when printed: 大

The receipt printer that i use for printing is : EPSON TM-u220 and POSTECH RP76III

1
Seems you've string encoding problem (UTF-8/Unicode treated as ANSI string). Can you give some relevant code pieces & the output given by RawPrinterHelper?Tetsuya Yamamoto
You'll have to read the programming manual. There is a command that switches the active character set.Hans Passant

1 Answers

0
votes

Before trying to print chinese characters you have to enable Chinese mode. I'm doing it with Java but probably it should be similar.

addTwoArrays(byteArrayOf(0x1c,0x26), toBytes(chineseText,"CP936"))

You can find more about this on printer specs. The above command is: FS &

enter image description here