How to print caret(^) character in Zebra Programming Language?
Asked Answered
A

3

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.

Aerometer answered 6/4, 2015 at 13:14 Comment(0)
N
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)

Nuclease answered 8/4, 2015 at 9:21 Comment(0)
A
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.

Aaronson answered 15/12, 2017 at 12:42 Comment(0)
C
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.

Clippard answered 31/3, 2022 at 3:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.