Zebra 打印机无法打印 UTF-8 字符
UTF-8 character not printing with Zebra printer
我正在尝试在 Zebra Z410 标签打印机上打印波斯语字符。但由于某种原因它正在打印??????。我发送给打印机的 ZPL 代码是
^XA
^FO50,50
^PA1,1,1,1
^A@N,50,50,E:TT0003M_.TTF^FDعاسشاتعفثه^FS
^XZ
我正在使用 Zebra Setup Utilities-Open communication with printer。请帮忙!!
您上面的示例没有指定 ^CI28,这会让您使用 UTF-8 而不是十六进制字段。
^XA
^FO50,50
^PA1,1,1,1
^A@N,50,50,E:TT0003M_.TTF^CI28^FDù?
^XZ
Zebra Setup Utilities 未正确处理 UTF-8。我刚刚使用 PuTTY 对网络打印机进行了测试,UTF 得到了正确处理。 SDK中也有使用UTF-8打印的例子
// Print a stored format with the given variables. This ZPL will store a format on a printer,
// for use with example3.
// This example also requires the ANMDS.TTF font to have been download to the printer prior to using this code.
// ^XA^DFE:FORMAT3.ZPL
// ^FS
// ^FT26,223^FH^A@N,56,55,E:ANMDS.TTF^CI28^FH\^FN12"Customer Name"^FS
// ^FT26,316^FH\^A@N,56,55,E:ANMDS.TTF^FH\^FN11"Invoice Number"^FS
// ^FT348,73^FH^A@N,39,38,E:ANMDS.TTF^FH\^FN13"Vendor Name^FS
// ^BY2,4^FT643,376^B7N,4,0,2,2,N^FH\^FDSerial Number^FS
// ^FO5,17^GB863,379,8^FS
// ^XZ
private void example3() throws ConnectionException {
Connection connection = new TcpConnection("192.168.1.32", TcpConnection.DEFAULT_ZPL_TCP_PORT);
try {
connection.open();
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
Map<Integer, String> vars = new HashMap<Integer, String>();
vars.put(12, "东风伟世通汽车饰件系统有限公司"); // Customer Name
vars.put(11, "订单号"); // Invoice Number
vars.put(13, "供应商名称"); // Vendor Name
printer.printStoredFormat("E:FORMAT3.ZPL", vars);
} catch (ConnectionException e) {
e.printStackTrace();
} catch (ZebraPrinterLanguageUnknownException e) {
e.printStackTrace();
} finally {
connection.close();
}
}
}
我正在尝试在 Zebra Z410 标签打印机上打印波斯语字符。但由于某种原因它正在打印??????。我发送给打印机的 ZPL 代码是
^XA
^FO50,50
^PA1,1,1,1
^A@N,50,50,E:TT0003M_.TTF^FDعاسشاتعفثه^FS
^XZ
我正在使用 Zebra Setup Utilities-Open communication with printer。请帮忙!!
您上面的示例没有指定 ^CI28,这会让您使用 UTF-8 而不是十六进制字段。
^XA
^FO50,50
^PA1,1,1,1
^A@N,50,50,E:TT0003M_.TTF^CI28^FDù?
^XZ
Zebra Setup Utilities 未正确处理 UTF-8。我刚刚使用 PuTTY 对网络打印机进行了测试,UTF 得到了正确处理。 SDK中也有使用UTF-8打印的例子
// Print a stored format with the given variables. This ZPL will store a format on a printer,
// for use with example3.
// This example also requires the ANMDS.TTF font to have been download to the printer prior to using this code.
// ^XA^DFE:FORMAT3.ZPL
// ^FS
// ^FT26,223^FH^A@N,56,55,E:ANMDS.TTF^CI28^FH\^FN12"Customer Name"^FS
// ^FT26,316^FH\^A@N,56,55,E:ANMDS.TTF^FH\^FN11"Invoice Number"^FS
// ^FT348,73^FH^A@N,39,38,E:ANMDS.TTF^FH\^FN13"Vendor Name^FS
// ^BY2,4^FT643,376^B7N,4,0,2,2,N^FH\^FDSerial Number^FS
// ^FO5,17^GB863,379,8^FS
// ^XZ
private void example3() throws ConnectionException {
Connection connection = new TcpConnection("192.168.1.32", TcpConnection.DEFAULT_ZPL_TCP_PORT);
try {
connection.open();
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
Map<Integer, String> vars = new HashMap<Integer, String>();
vars.put(12, "东风伟世通汽车饰件系统有限公司"); // Customer Name
vars.put(11, "订单号"); // Invoice Number
vars.put(13, "供应商名称"); // Vendor Name
printer.printStoredFormat("E:FORMAT3.ZPL", vars);
} catch (ConnectionException e) {
e.printStackTrace();
} catch (ZebraPrinterLanguageUnknownException e) {
e.printStackTrace();
} finally {
connection.close();
}
}
}