Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unicode characters on ZPL printer

Tags:

I have the task of re-designing a system to print shipping labels, using a networked Zebra GK420T. I have been able to send ZPL print jobs to it perfectly fine, but I cannot seem to get it to print unicode characters, such as cyrillic letters. I have downloaded the lucida sans unicode font to the printer using the Seagull Scientific drivers and I am using the following ZPL code to test:

^XA ^LH100,150 ^CI28 ^FT0,0^A@N,50,50,R:LUCIDASR.FNT^CI28^FDTesting 1 2 3^FS ^FT0,50^A@N,50,50,R:LUCIDASR.FNT^CI28^FDДо свидания^FS ^FT0,100^B3^FDAAA001^FS ^XZ 

It will print the 'Testing 1 2 3' and the barcode, but it leaves a blank space instead of the cyrillic characters.

I also tried using the Zebra swiss unicode font and now it prints the russian characters as question marks:

^XA ^LH100,150 ^CWT,E:TT0003M_.FNT ^CFT,30,30 ^CI28 ^FT0,0^FDTesting 1 2 3^FS ^FT0,50^FDДо свидания^FS ^FT0,100^B3^FDAAA001^FS ^XZ 

Am I doing something wrong like not escaping characters or something or is it a problem with the printer?

like image 442
Tom Brunoli Avatar asked Oct 23 '12 23:10

Tom Brunoli


People also ask

What is ZPL format?

The Zebra Printer Language (ZPL) format is a full-featured printer language for producing labels that contain text, barcodes, lines and boxes, and graphics. When using a ZPL file as input, eFORMz reads in the individual elements on the label and converts them into the eFORMz proprietary device-independent format.

What is PW in ZPL?

Refer to ZPL Commads: ^PW - Print Width.


2 Answers

I just discovered that you need to escape characters above ASCII by first putting ^FH before any ^FD fields that could contain a utf character and you need to prefix the utf-8 hex code with an underscore

_D0_94 will print as Д. My final ZPL code is as follows:

^XA ^LH100,150 ^CWT,E:TT0003M_.FNT ^CFT,30,30 ^CI28 ^FT0,0^FH^FDTesting 1 2 3^FS ^FT0,50^FH^FD_D0_94_D0_BE _D1_81_D0_B2_D0_B8_D0_B4_D0_B0_D0_BD_D0_B8_D1_8F^FS ^FT0,100^B3^FDAAA001^FS ^XZ 

I'm just going to have to make a way to generate the escape sequences, which should be much easier!

like image 179
Tom Brunoli Avatar answered Sep 16 '22 12:09

Tom Brunoli


I had the same problem, you should add an ^FH(Field Hexadecimal Indicator) before any ^FD(Field Data) command that contains special characters, in my case I need spanish chars so I had to use ^CI28(Change International Font/Encoding)

UTF 8 HEX codes list

sample: to print Alvaro Jesús Pérez Peñaranda we need to convert those special characters to UTF 8 Hex code and add an _ before each code, this is the result: Alvaro Jes_c3_bas P_c3_a9rez Pe_c3_b1aranda

^XA  ^CI28 ^FO60,75 ^ASN,36,20^FH^FDAlvaro Jes_c3_bas P_c3_a9rez Pe_c3_b1aranda^FS  ^XZ 
like image 22
Christian Rojas Avatar answered Sep 16 '22 12:09

Christian Rojas