DantSu / ESCPOS-ThermalPrinter-Android

Useful library to help Android developpers to print with (Bluetooth, TCP, USB) ESC/POS thermal printer.
MIT License
1.23k stars 375 forks source link

Japanese Character Print #31

Closed ghost closed 4 years ago

ghost commented 4 years ago

@DantSu

Hi, This is my second issue. I need to print Japanese characters. My printer can support Japanese characters and has the same codepage as EPSON. I tried many different variations but I was unable to print simple Japanese characters. Can you please give me some suggestions? How should I write the EscPosCharsetEncoding function? Thank you.

DantSu commented 4 years ago

My printer have this id for charsets : 20200623_151000

Here is charset id for an Epson printer : https://www.epson-biz.com/modules/ref_escpos/index.php?content_id=32

You have to find the correct charset for Japanese char for your printer. I can't help you more.

ghost commented 4 years ago

@DantSu

Thank you so much for replying.

I understood the codepage thing a little bit. I have mailed my printer company for the printer's codepage. They usually reply very fast. When I get the codepage, I will try again. I might have some questions that I want to ask you. That's why I am not closing this issue for now. Is it okay to do?

Thank you.

DantSu commented 4 years ago

Yes, keep open this issue. Say me when all is done.

ghost commented 4 years ago

@DantSu

Thank you so much.

I have got my printer's Codepage list.

image0

I want to print all kinds of Japanese characters consists of Hiragana, Katakana & kanji. Now how should I write the EscPosCharsetEncoding function?

I have tried the below code but it still doesn't work EscPosPrinter printer = new EscPosPrinter(new TcpConnection("192.168.1.5", 9100), 203, 80f, 48, new EscPosCharsetEncoding("Shift_JIS", 1));

DantSu commented 4 years ago

x-IBM942 | Cp942 | ibm-942 cp942 ibm942 942 | IBM OS/2 Japanese, superset of Cp932

Try this :

new EscPosCharsetEncoding("x-IBM942", 1) new EscPosCharsetEncoding("x-IBM942", 29)

May be that will work

ghost commented 4 years ago

@DantSu

It didn't work :( :(

I also tried other things like IBM942 ibm-942 ibm942 IBM943

This also Doesn't work.

English characters are printing fine but Katakana characters are printing garbage values. Are there any other suggestions?

DantSu commented 4 years ago
new EscPosCharsetEncoding("IBM290", 1)
new EscPosCharsetEncoding("IBM290", 29)
new EscPosCharsetEncoding("JIS_X0201", 1)
new EscPosCharsetEncoding("JIS_X0201", 29)
new EscPosCharsetEncoding("x-IBM930", 1)
new EscPosCharsetEncoding("x-IBM930", 29)

I haven't more options after that.

https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html

ghost commented 4 years ago

@DantSu

Thank you so much for the references. I couldn't get it to work properly.

I am trying to solve the Unicode problem by using HTML 2 image. And then printing that image.

Reference - HTML2Image_ESC_POS

Thanks a lot for your time and support. :)

krispusis1991 commented 2 years ago

excuse me i want to print thai language How it works EscPosCharsetEncoding("?", ?)