ZPLToolkit

^FH

Field Hexadecimal IndicatorPreview: exact

Lets ^FD carry bytes written as _XX escapes — the only way to print a literal ^ or ~ in field data.

Syntax

^FHa

Parameters

ParameterDescription and accepted valuesIf omitted
aThe character that introduces a hex escape. Pick one that does not otherwise appear in the data.Any single character_ (underscore)

How it works

^FH tells the printer that the next ^FD contains hexadecimal escapes: an underscore followed by two hex digits stands for one byte. _5E is a caret, _7E is a tilde, _5F is an underscore itself.

This exists because ^ and ~ introduce commands. Written directly in ^FD they end the field, and the rest of your data is executed as ZPL. ^FH is the escape hatch, and it is what you need for prices with a caret, paths with a tilde, or any data coming from a database you do not control.

The optional parameter changes the escape character if underscore itself is common in your data. ^FH applies to the next ^FD only and is cleared by ^FS, so it has to be repeated for every field that needs it.

Example

ZPL
^XA
^FO40,60^A0N,40,40^FH^FD100_25 _5E _7E^FS
^XZ

Rendering…

_25, _5E and _7E print as %, ^ and ~ — characters ^FD cannot carry directly.
Open in the viewer

How the preview on this site handles it

Fully supported, including a custom indicator. Escapes for multi-byte UTF-8 are expanded byte by byte, which matches a printer that has not selected UTF-8 with ^CI28.

Common mistakes

  • Putting ^FH after ^FD. It has to come first, or the escapes print literally.
  • Expecting ^FH to carry over to the next field. It is cleared by ^FS.
  • Using an odd number of hex digits. _5 is not an escape and prints as written.

See also