5

Using version: ZPL2.

Format prefix: ^.

Can someone please help how to print caret(^) character using ZPL II. Either we need some escape sequence or any other way of printing this Format Prefix(^) as a normal character.

Note: Don't want to change the format prefix(^) to some other character.

Any help would be highly appreciated.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195

3 Answers3

5

You need to use ^FH before your ^FD and then use the hex value of the caret : _5E

^XA
^FO100,100
^AD^FH
^FDCaret _5e used for HEX^FS
^XZ

See also : How to print a tilde (~) in Zebra Programming Language (ZPL)

Community
  • 1
  • 1
NeeL
  • 720
  • 6
  • 20
4

You can try to change format prefix of ZPL code which is ^ into different one ex. ¬ using ^CC. After print command, reverse the change back to ^.

^XA ^CC¬ ¬FO30,20¬FD_AB534^H¬FS ¬CC^ ^XZ

The ^FH and _5e solution is also good but will not work in all cases. If you use ^FH command it will convert everything which appear to be hex value

example - you want to print wifi password which is: _AB534^H. Normally you would use code:

^XA ^FO50,50 ^FD_AB534^H^FS ^XZ

this code will print only:_AB534

with ^FH command and replacing ^ with _5E will look like:

^XA ^FO50,50 ^FH^FD_AB534_5EH^FS ^XZ

it prints: ½534^H

Password is different than _AB534^H. this is because ^FH reads _AB as a HEX value and converts it as well

using this code:

^XA ^CC¬ ¬FO30,20¬FD_AB534^H¬FS ¬CC^ ^XZ

output is:_AB534^H

sign ¬ can not be entered simply from keyboard (without alt+ combination) so will not be used in wifi passwords.

dns
  • 41
  • 1
0

Another option is to escape "_" as "_5f" and then escape "^" as "_5e". This protects against accidental decoding of a string already containing "_" without encoding every single character in ^FD, ^FV or ^SN commands.

In c#, this would be:

return value.Replace("_", "_5f").Replace("^", "_5e");

This is not the most efficient code, but is concise.