encoding and special characters

995 views
Skip to first unread message

pers

unread,
Feb 17, 2014, 5:06:06 AM2/17/14
to jzebra...@googlegroups.com
Hi all,

I have a problem with printing a few special characters on a MicroPOS WTP-100 printer (č,š,ž, Č,Š,Ž). I checked and the printer supports the appropriate code page (CP 852).
I found the command specifications for the printer (http://www.star-m.jp/eng/service/usermanual/linemode_cm_en.pdf) where it lists the command for the code page selection:  ESC GS t 5.

Based on the above data, I tested the following code on the printer:

qz.setEncoding("cp852");
qz.append(chr(27) + chr(29) + chr(116)+'5'); //ESC GS t 5
qz.append("蚞ȊŽ");

When I tested the code i got some weird characters. I am missing something? Do I have to transform the letters into a different form?

Thank you for the help,

Best Regards

Tres Finocchiaro

unread,
Feb 18, 2014, 10:22:01 AM2/18/14
to jZebra users
@Pers,

Thank you for contacting the community mailing list.

I noticed you linked to a Star command specification.

In this case, I believe '5' is not character, it is decimal.  You would need to do chr(5) or '\x05' (I believe this because the table goes to 255 = '\xFF')

Character sets/encoding are usually printer specific.  Do you have some documentation from MicroPOS with instructions to do this?  How are you sure the Star user manual is correct for that printer?

We test our software on Epson TM88V printer, which is industry standard ESC/POS printer, however, the character encoding varies greatly even between Epson models and documentation is very poor.  To print Latin I had to do much trial and error.  This is because codepages are usually stored in lookup tables.

For this reason, we do not have code page examples in sample.html.

I tried to look up MicroPOS but was unable to find a manufacturer website for them.

Here is the best documentation we have so far:


-Tres

--
--
To unsubscribe from this group, send email to jzebra-users...@googlegroups.com
 
http://code.google.com/p/jzebra
 
---
You received this message because you are subscribed to the Google Groups "jZebra users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jzebra-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

pers

unread,
Feb 18, 2014, 10:54:50 AM2/18/14
to jzebra...@googlegroups.com
Hi Tres,

Thank you for your answer.

The documentation for this MicroPOS printer is hard to find. I was able to find this page (http://www.mikroing.si/index.php?option=com_content&view=article&id=81&Itemid=241) where I got some information about the emulation and codepage support.
As far as I understand the printer supports ECS/POS (Epson), TSP600 (Star) and TMT-88III (Citizen) commands. Through trial and error I was able to determine that only Star commands work on this particular printer. Alignment and cut commands from the linked specification worked; therefore, I assumed that also code page selection should work. Do you think my assumptions are OK?

The reason I've used '5' instead of chr(5) is that chr(5) is the ENQ character and I thought that they would write ENQ in the specifications instead of 5.  I will try to send 5 as a decimal and not as a character, unfortunatelly I cannot try this before next week since our customer is on leave this week.

Should I try to send the special character in the Unicode format, as you did in the provided example? Or should regular characters work anyway?
Could there be a conflict between the provided characters in the Unicode format and the expected characters for the cp852?

Thank you again for your help.

Best regards

Tres Finocchiaro

unread,
Feb 18, 2014, 3:35:35 PM2/18/14
to jZebra users
Alignment and cut commands from the linked specification worked; therefore, I assumed that also code page selection should work. Do you think my assumptions are OK?
It's impossible to know without the brutal process of trial and error at this point.  I would recommend trying every combination of ESC/POS codepage commands you can find on the internet, or invest into a printer with better documentation (as I stated, Epson's documentation lacked in this regard too, but at least they will pick up the phone if I need support, and I have had to call them).
 
Should I try to send the special character in the Unicode format, as you did in the provided example?
It's a good idea to rule out issues.
 
Or should regular characters work anyway?
There are multiple snags with character encoding and one of them is the fact that JavaScript actually looks at the encoding of the web page/js file to determine how the data should be represented.  

Fortunately if the characters in the document match the encoding of the document (usually unicode) the you are ok. In many cases, this is fine, but depending where your html or javascript files originated, this can cause a mess.  When I did have a document in the wrong format it wasn't very obvious and Notepad++, which is what I use for testing, doesn't always warn you if there are characters that can't be displayed.

Fortunately as long as they do match, Java does a fantastic job converting them to the codepage specified, but if the printer isn't prepared for them, you usually get symbols and rubbish on the receipt.

The unicode notation is just a troubleshooting step, since the character equivalent is much easier to read, that is what I would recommend once you get it all working.

What helped me the most was creating a loop to force the printer through it's codepages.  It wasn't pretty, but I did something like this:
for (var x = 0; x <= 255; x++) {
    qz.append(chr(27) + chr(29) + chr(116) + chr(x));
    qz.append("čšžČŠŽ (using table: " + x + ")");
    qz.print();
}


 

 


Ales Tavcar

unread,
Mar 6, 2014, 5:07:23 AM3/6/14
to jzebra...@googlegroups.com
Hi Tres,

I would just like to thank you for your help. I was able to successfully print the characters.

Here is what I did (in case somebody else encounters the same problem):
Save the html file as Unicode, set the html encoding meta data to UTF-8
Set the encoding for qz-print and the printer
   qz.setEncoding("IBM852");
   qz.append(chr(27) + chr(29) + chr(116) + chr(5));

And it worked.

I have just one last question more related to printers.
Is there usually a way to have different alignments in one line? The first string(e.g., product) aligned left and the second(e.g., price) aligned right.
What I do now is to fill the right amount of spaces between the two strings.
The same question goes for font sizes. Can I set only one size for the entire line?

Best regards,
Ales



--
--
To unsubscribe from this group, send email to jzebra-users...@googlegroups.com
 
http://code.google.com/p/jzebra
 
---
You received this message because you are subscribed to a topic in the Google Groups "jZebra users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jzebra-users/VZsEnxj5rE4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jzebra-users...@googlegroups.com.

Tres Finocchiaro

unread,
Mar 6, 2014, 8:21:08 AM3/6/14
to jZebra users, Eko Wahyudiharto
@Ales,

> Is there usually a way to have different alignments in one line? The first string(e.g., product) aligned left and the second(e.g., price) aligned right. What I do now is to fill the right amount of spaces between the two strings.
> The same question goes for font sizes. Can I set only one size for the entire line?

I'm pretty sure the method you are using for alignment is the preferred method.

I am not very good with ESCP so I've put a friend Eko on CC of this email.  He may be able to offer some more information.

-Tres
You received this message because you are subscribed to the Google Groups "jZebra users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jzebra-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages