This project is read-only.

Printing double quotation character " with TextCommand

Feb 20, 2013 at 3:00 PM
Hi. Does anyone know of a way in which I can use the TextCommand function to include the double quotation character " within the text value parameter? Basically I need to print a measurement value, in inches, on my label, i.e. 1".

The raw data for this command ends up looking like A185,95,0,4,1,1,N,"1"" which is clearly confusing the Zebra printer as its recongising the inch character as the termination of the value string, and I'm presuming the double quotation character which actually terminates the string is then causing issues.

If I remove the inch character so the raw data is thus A185,95,0,4,1,1,N,"1", it prints fine, albeit without the inch character, which I need.

I think the problem is stemming from the issue of having a "string within a string", which is done with the TextCommand function string.Format of "A{0},{1},{2},{3},{4},{5},{6},\"{7}\"", {7} being the text value. If I attempt to insert an inch character into this value using \", then C# expresses the string in debug as "A185,95,0,4,1,1,N,\"1\"\"".

Anyone know of a way to accomplish this?

Feb 21, 2013 at 5:18 AM
This is a bug in the latest official build. You can either download my updated version (source code / patches) or add Encoding.GetEncoding(437) to the printbuffer procedure.
Feb 21, 2013 at 3:39 PM
Many thanks for your reply. I'm not sure which build I have installed, but I managed to resolve this shortly after sending the original post. I had previously tried sending double quotes within the text parameter of the TextCommand function to the Zebra printer, but the rawData (expressed in VS2010) was appearing as A185,95,0,4,1,1,N,\"1\"\". I managed to download the documenation for the API, and found inserting a backslash immediately prior to the inch character within the text parameter resolved this. So my code simply replaces a double quote with a blackslash + double quote, i.e. text = text.Replace("\"", "\\""). This then expresses the rawData as A185,95,0,4,1,1,N,\"1\\"\", which the Zebra printer recognises as double quotes within the text string.