2 Replies Latest reply on Jan 3, 2017 6:43 PM by Kira Raki

    Printing Chinese via ZPL code without using font

    Kira Raki

      Hello everyone,

       

      Could you please take a look on my problem?

       

      I am trying to printing Unicode characters via ZPL code without using font.

      I was successful with some Unicode language by using hex in ZPL code.

      For example:

      ^XA

      ^CI28

      ^FO60,75

      ^ASN,36,20^FH^FD_46_6c_c3_bc_67_65_6c^XZ

      Result: Flügel

       

      However, when I try to print Chinese with the same way, nothing is printed to the printer.

      This is my python code for printing:

       

      #!/usr/bin/env python

      # -*- coding: utf-8 -*-

      #ZPL docs can be found at https://support.zebra.com/cpws/docs/zpl/zpl_manual.pdf

      #This works with Python 2, change the str to bytes if you are using Python 3

      import sys

      import socket

      import csv

      import os

      import pdb

      import sys

      import binascii

       

       

      TCP_IP = '127.0.0.1'

      TCP_PORT = 9100

      BUFFER_SIZE = 4096

       

       

      s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

      print s

      s.connect((TCP_IP, TCP_PORT))

       

       

      zpl = """^XA

       

       

      ^CI28

      ^FO60,75

      ^ASN,36,20^FH^FD"""

      zpl = zpl + "_" + "_".join("{:02x}".format(ord(c)) for c in "传傳")

          #zpl = zpl + "_e7_8e_ab"

      zpl = zpl + """^XZ"""

      print zpl

      s.send(str(zpl))

       

       

      s.close()

       

      Thanks in advance for any helps.