iljabauer / python-escpos

Automatically exported from code.google.com/p/python-escpos
GNU General Public License v3.0
0 stars 0 forks source link

Spanish characters #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm pretty sure this is something you already have solved because you are 
Spanish speaker too, at least that's what I guess for your name.

How do you do for send to print spanish characters like: á, é í, ó, ú, ñ?

Thanks a lot in advance

Original issue reported on code.google.com by ati...@gmail.com on 16 Aug 2013 at 4:55

GoogleCodeExporter commented 9 years ago
Hi Agustin,

I'm sorry, I haven't tried yey to send accented characters.
Do you mind to tell me what the output is when you send those characters to the 
printer?

Your feedback is well appreciated.

Thank you.

Original comment by manpaz on 3 Sep 2013 at 11:28

GoogleCodeExporter commented 9 years ago
Don't worry, just think that because of your name you have done something 
similar.

When I try print accented characters I have two behaviors:

1.- When using an archlinux box the output is a ticket with black boxes instead 
of accents.
2.- When using a Linux mint/ Ubuntu boxes the printer stops processing the 
print job when found any accented character or "ñ"

What I have done to deal with it at this moment, I must admit that don't have 
much time to deal with it, is add a u_object.encode('utf-8') to my variables 
before send it to print. 

That help to prevent stopping printing on ubuntu/linuxmint but prints a random 
char, I guess because spanish chars are not in default char tables for printer. 

So I think the ideal solution will be to add another function that allow user 
to select a char table for printer.

Original comment by ati...@gmail.com on 4 Sep 2013 at 5:14

GoogleCodeExporter commented 9 years ago
You right, trick will be to set the proper table.
Think I saw some commands on Epson documentation.
I'll be trying to play with, and if I'm done with this I'll be letting you know.

Once again, thank you for your help.

Original comment by manpaz on 4 Sep 2013 at 7:31

GoogleCodeExporter commented 9 years ago
Hello !

I'm facing the same issue (actually I just wanted to print a € symbol).
I looked at the ESC/POS documentation and I found this command to change the 
table :

Select character code table
ESC t n
n refers to the proper table.

So I tried to send the following in python with :
myprinter._raw('\x1b\x74\x19')

\x19 refers to the PC858 (Euro) table

Then I tried those lines :
myprinter._raw('\xd5')
myprinter._raw('€')

But I still have the same issue. The characters table is always the default one 
(PC437 (USA: Standard Europe))

Did I miss something ?

ps: my printer is an epson TM-H6000III 

Original comment by marcel.a...@gmail.com on 11 Dec 2013 at 12:26

GoogleCodeExporter commented 9 years ago
Hey !

I finally solve the issue (I mean at least it works with my printer)
Actually I was wrong with table selection. The good one is \x1b\x74\x13

So all you have to do for printing a ñ is to send those lines:

storePrinter._raw('\x1b\x74\x13')
storePrinter._raw('\xa4')

You can find the others characters at the page 84 of this doc 
http://www.dig-it.de/download/manuals/epson_TM-T88III_technical_reference.pdf

Original comment by marcel.a...@gmail.com on 18 Dec 2013 at 3:08

GoogleCodeExporter commented 9 years ago
Hi marcel.aurelien,

Is good to hear that.
I'll be adding a feature to select the proper table, based on your findings.

Thank you for your contribution to the project.

Original comment by manpaz on 2 Jan 2014 at 8:38

GoogleCodeExporter commented 9 years ago
Hi, just discovered this. Thanks for a great library, and just FWIW, somebody 
already seems to have solved this issue in a fork.

See 
https://github.com/jbittencourt/python-escpos/commit/736f303bebf89cb641ba808430f
ea7722967a974

Itd be great if you could add this functionality.

Cheers!

Original comment by jcan...@gmail.com on 9 Sep 2014 at 1:24