Unicode characters on ZPL printer

Tom Brunoli picture Tom Brunoli · Oct 24, 2012 · Viewed 88.2k times · Source

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?

Answer

Tom Brunoli picture Tom Brunoli · Oct 24, 2012

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!