Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot write special characters for network printer #545

Open
taherrera opened this issue Aug 14, 2023 · 3 comments
Open

Cannot write special characters for network printer #545

taherrera opened this issue Aug 14, 2023 · 3 comments

Comments

@taherrera
Copy link

Bug description

I am trying to print latin-1 characters such as "á", "É", "ñ" but I get printed chinese characters instead. I have tried changing to other codepages such as "PORTUGUESE" or "MULTILINGUAL" but it prints the same chinese characters all the time.

Steps to reproduce

#!/usr/bin/python
# -*- coding: latin-1 -*-

from escpos.printer import Network

x = Network("192.168.123.100")
x.charcode(code="WEST_EUROPE")
x._raw("ñ\n".encode('latin-1')) 
x.text("ñ\n") # same..
x.cut()
exit()

Device info

Printer: Xprinter XP-T80A firmware version 3.010PR6G

The Selftest indicates that it supports codepage 6 (West Europe) and many others. It also says: Resident Character: Alphanumeric and Simplified Chinese GB18030

python-escpos version: 2.2.0

python version: 3.6.13

operating system: Ubuntu 16.04LTS

@patkan
Copy link
Member

patkan commented Aug 14, 2023

Hi,
could you please try out the version 3 pre-release?
Apart from that, do you have a manual for that printer? With that you should be able to obtain the byte sequence for the expected codepages. With that you could try with the raw-method first if your printer supports this really, and then use the Dummy-printer instance to compare what the lib generates.

@taherrera
Copy link
Author

Hello,
I ran out of paper, I will try version 3 as soon as I am able to get more. I have got a manual, but it does not indicate any esc/pos commands. However I found this russian tutorial and it indicates I should send these commands before changing the codepage (to russian text):
1F 1B 1F FE 01

1F 1B 1F FE 11

Do you know what these commands are ?

There is also some software .exe, I will try to tap on the socket with wireshark to get more info.

Thanks

@patkan
Copy link
Member

patkan commented Sep 2, 2023

These numbers are likely the hex sequence for escpos codepage changes.
You can compare them to the output of this lib (use file printer, print to file and then compare in a hex editor), but I would assume this lib issues already the correct sequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants