Cannot Print Greater-Than (">") Characters in Code-128 Barcode When Using Zebra Printer

Description

When attempting to use data strings that contain the ">" character in a Code 128Closed A versatile, variable length symbology that can encode all 128 ASCII characters through the use of 106 unique character patterns. barcode formula, these characters are not present when the resulting label is printed and scanned. This issue is specific to Zebra printers and Code 128 encoding. Code 128 allows for encoding of all 128 characters of ASCII. Unfortunately, the '>' character is also used as an escape sequence control character by Zebra printers. Depending on the position of this character, if used in the barcode data, there might be some unintended consequences. At a minimum, the '>' character will not be present in the data when the resulting printed barcode is scanned. Inserting a zero ('0') right after the greater-than character nullifies this behavior and allows the resulting barcode to produce the scan output expected.

How to force these characters to print

  1. For the input data string, the ">" character must be immediately followed by a "0" (zero)
  2. This is demonstrated in the following example

Example

  1. Construct a label designed for using a Zebra printer
  2. Create two variable fields, one named 'Item' and another named 'Qty', with keyboard data source
  3. Create a barcode with Code 128 symbology
  4. Set the Code 128 barcode data source to Formula
  5. Apply the following string to the formula: "<STX>" & "I:" & Item & "|Q:" & Qty & "<ETX>"
  6. Save the label



  7. Use Test Print in the Designer to print a label
  8. Scan the resulting barcode on the label
  9. Data will show as - <STX:1234567890|Q:12345678<ETX
  10. Modify the formula from step 5 as follows: "<STX>0" & "I:" & Item & "|Q:" & Qty & "<ETX>0"
  11. Repeat steps 7 & 8 and verify the barcode scan results are now as expected




Note: 

The above example is for a formula that contains static values for the '>' character within the formula itself.
It may be necessary to modify the Human Readable portion of the label, because the above change will cause the '>0' to be printed out in that area as well. Simply replace the Human Readable field with another variable field that uses a formula similar to the original one (as shown in Step 5 above).

If data source is coming in from an external source, it is possible to use a script to convert the input data string carrying the '>' character. This is a sample of how to apply this concept using a basic script:

//Replace '>' characters with '>0'

var input = String(label.fields.field.(@name == 'Pre1').@data);

input = input.replace(/>/g,  '>0' )

label.fields.field.(@name == 'Pre1').@data = input;

Additional information related to this topic is available here:

https://km.zebra.com/kb/index?page=content&id=SO7541