This Instruction Article explains how to insert hex characters into ZPL code for Zebra printers. Often this is used to get the printer to embed special non-ASCII codes into barcodes. Meeting GS1 standards, sometimes, requires the use of special characters (e.g. FN1, etc.) for example.
- Create ZPL code instructions for the printer
- Insert the Field Hex Indicator command (i.e. ^FH) with the indicator value immediately before the corresponding ^FD command. If a blackslash, for example, is to indicate that the next two characters are hex, then the Field Hex Indicator command syntax would be ^FH\.
- If a hex value is to be inserted into the data for that line, after the corresponding ^FD command, use the designated Field Hex Indicator value (e.g. \) and then insert the two hex values immediately after them (e.g. ^FH\^FDTilde \7e Inserted as Hex^FS will result in the text “Tilde ~ Inserted as Hex” printed on the label since 7e is the hex value for the tilde character).
Note: If no Field Hex Indicator value is set, an underscore (“_”) is the default value.
Outside Sources and Helpful Links
See p.165 of the Zebra ZPL Programming Guide: Zebra ZPL Programming Guide #P1012728-011
The full syntax of the Field Hex Indicator command in ZPL is: ^FHa.
- ^FN is the ZPL command
- a is the symbol that tells the printer (after the ^FD and before the ^FS commands) that the next two character need to be read as hex (not ASCII)
Example: The ^FH\^FDTilde \7e Inserted as Hex^FS command will result in the text “Tilde ~ Inserted as Hex“