Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print a double quote using a Zebra printer with EPL?

In Java, I want to print a label with a String as the input:

 String command
            = "N\n"
            + "A50,5,0,1,2,2,N,\"" + name + "\"\
            + "P1\n";    

But when the input (name) has a double quote character ("), it is blank and prints nothing. I have tried using the replace function:

name.replace('"', '\u0022');          

but it doesn't work. I want that double quote printed in label, how can I do this?

like image 867
wanz Avatar asked May 25 '26 04:05

wanz


1 Answers

Sending the " character in the text field of the EPL string makes the EPL code think it is the end of the string you are trying to print.

So, if you want to send(and print) "hello" you have to put a backslash before each " character and send \"hello\"

You also have to do that for backslashes.

So, your (EPL)output to the printer would have quotes to begin and end the string, and \" to print the quote characters WITHIN the string :

A30,210,0,4,1,1,N,"\"hello\""\n

Also remember you have to escape to characters to build a c# string so in c# it would look like this: outputEPLStr += "A30,210,0,4,1,1,N,\"\\"hello\\"\"\n";

[which contains 6 escaped characters]

like image 88
Michael Kosak Avatar answered May 26 '26 22:05

Michael Kosak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!