Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print characters with an acute in ZPL

If I send the ZPL commands below to a Zebra printer, it prints AmitiÙ:

^XA
^FO50,20
^CI7
^A0N,25,15
^FD
Amitié
^FS
^XZ
  • Note that the file encoding is ANSI.
  • Note the use of the ZPL command ^CI7 (7 => Single Byte Encoding - France 1 Character Set).

On the other hand, if I send the ZPL commands below to a Zebra printer, it prints Amitié (which is what I actually need to get):

^XA
^FO50,20
^CI28
^A0N,25,15
^FD
Amitié
^FS
^XZ
  • Note that the file encoding is UTF-8.
  • Note the use of the ZPL command ^CI28 (28 => Unicode (UTF-8 encoding) - Unicode Character Set).

Do you know what's wrong in the first case?

Thank you for helping.

like image 241
Léa Massiot Avatar asked Apr 03 '15 17:04

Léa Massiot


People also ask

How do you draw a vertical line in ZPL?

There is not a separate command to draw a simple horizontal or vertical line, but the ^GB command can be used for this purpose by drawing a rectangle with height = 1 (horizontal line) or width = 1 (vertical line).

What are ZPL commands?

Zebra Programming Language (ZPL) is the command language used by all ZPL compatible printers. It is a command based language used by the printers as instructions to create the images printed on the labels.

How do you rotate a ZPL code?

The ZPL command ^FW – Field Orientation can be used to rotate the printout. The ^FW command sets the default orientation for all command fields that have an orientation (rotation) parameter. Fields can be rotated 0, 90, 180, or 270 degrees clockwise by using this command.


2 Answers

Use UTF-8 by placing a ^CI28 command at the top of your ZPL template, eg

^XA
^CI28
^CF0,80
^FO70,40^FDavión^FS
^XZ
like image 53
sports Avatar answered Sep 21 '22 10:09

sports


According to the programing guide document from Zebra ^CI using 7 will get you Code Page 850 with some specific character replacements. When you say you had the file encoded in ANSI, I assume you mean Code Page Windows-1252 or ISO-8859-1 (latin1).

The character é in Windows-1252 and latin1 is #00E9, but that's Ú in 850; you would want #0082 for é in 850. Using ^CI7 you could apparently also get an é with #007B since that's one of the specific character replacements made with that command.

Using UTF8 (with ^CI28) is probably the way to go since it's widely supported and understood, but note that you could also try ^CI27 (which may work even if you have an older version of the Zebra firmware that doesn't support ^CI28) and that should get you code page 1252. If that doesn't work you'll need to encode your text using code page 850.

like image 21
othp Avatar answered Sep 19 '22 10:09

othp