githubashto / jzebra

Automatically exported from code.google.com/p/jzebra
0 stars 1 forks source link

Print Greek #130

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I want to print greek chars. applet.append(printString);
2.I have tried both document.jzebra.setEncoding("UTF-8"); and 
document.jzebra.setEncoding("cp1253"); and nothing worked.

What is the expected output? What do you see instead?
In both encodings I just see some wierd chars printed. English/Latin chars that 
also exist are  printed fine in teh same printString

What version of the product are you using? On what operating system?
jZebra 1.4.7
Windows

Original issue reported on code.google.com by adomv...@gmail.com on 25 Apr 2013 at 5:38

GoogleCodeExporter commented 9 years ago
The only solution that I can think of is to convert the Greek Chars to 
Hexadecimal.
Some more information that I have found and that could help you understand the 
issue I am facing.
I have changed the document.jzebra.setEncoding("cp737");
This is supposed to be the right code page for Greek Language.
http://www.ascii-codes.com/cp737.html

The applet, recognized the new encoding and in the console.log it printed 
INFO: Current applet charset encoding: x-IBM737

http://www.fileformat.info/info/charset/x-IBM737/list.htm
BUT, when I tried to print some Greek Hex chars from the table above, it just 
display a questionmark ? in its place. Both in the console.log of java platform 
and at the printer.

So my new question is why doesn't it print the Greek Hex chars?
For example: \xA0\xA1\xA2\x87 etc

Hope someone can help me on this.
Thank you!

Original comment by adomv...@gmail.com on 25 Apr 2013 at 7:51

GoogleCodeExporter commented 9 years ago
Can you try this:
applet.setEncoding("UTF-8");
applet.append("\u0394");     // Unicode greek letter "Delta"
applet.append("\u03A3");     // Unicode greek letter "Sigma"
applet.append("\u03A9");     // Unicode greek letter "Omega"
applet.setEncoding("cp737"); // Convert string to x-IBM737 just before printing

applet.print();

For some reason with this approach, the file opens with a hex editor and 
reflects the CP737 values.  My guess would be that it's either a bug with 
jzebra or java.

Switching back to cp737 may not be needed if your printer supports unicode.

As far as the output in the Java Console, don't trust that, since cp1252 on 
Windows doesn't know how to display them.

I debugged this in Windows 8 by creating a Generic Text printer that printed to 
FILE: and then opened the PRN output file with XVI32.exe hex editor.

-Tres

-Tres

Original comment by tres.fin...@gmail.com on 25 Apr 2013 at 2:14

GoogleCodeExporter commented 9 years ago

Original comment by tres.fin...@gmail.com on 20 Jan 2014 at 1:18

GoogleCodeExporter commented 9 years ago

Original comment by tres.fin...@gmail.com on 20 Jan 2014 at 1:21

GoogleCodeExporter commented 9 years ago
Hello all, I am facing the same issue and you put me in the right direction 
here, by setting encoding to cp737 just before printing. In my case I set cp737 
to printer but not to applet, so I had to comment out line 1726 of 
PrintApplet.java in method setEncoding(String charset)  //this.charset = 
Charset.forName(charset);
So when inside javascript I call  qz.setEncoding("cp737"); it sets the 
printer's character set but leaves applet's character set being the default 
(UTF-8 in my system). Doing that, I call qz.append("ΔΣΩ\r\n"); and it prints 
correctly. 

I shall make more tests on this...

mike plexousakis
(qz-print 1.8.0, ubuntu 12.04) 

Original comment by mike.ple...@gmail.com on 7 Feb 2014 at 11:01