When attempting to use data strings that contain the ">" character in a Code 128 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
- For the input data string, the ">" character must be immediately followed by a "0" (zero)
- This is demonstrated in the following example
- Construct a label designed for using a Zebra printer
- Create two variable fields, one named 'Item' and another named 'Qty', with keyboard data source
- Create a barcode with Code 128 symbology
- Set the Code 128 barcode data source to Formula
- Apply the following string to the formula: "<STX>" & "I:" & Item & "|Q:" & Qty & "<ETX>"
- Save the label
- Use Test Print in the Designer to print a label
- Scan the resulting barcode on the label
- Data will show as - <STX:1234567890|Q:12345678<ETX
- Modify the formula from step 5 as follows: "<STX>0" & "I:" & Item & "|Q:" & Qty & "<ETX>0"
- Repeat steps 7 & 8 and verify the barcode scan results are now as expected
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:
All Supported Loftware Versions
All Supported Windows Environments