你好,我想问一个问题。我做了一个按钮,当我按下该按钮时,它会发送我想在打印机上打印的信息,我想用希腊语打印,如果我更改 ASCII,它不会打印希腊语,它会打印一些符号。任何帮助都是完美的..谢谢。。这是我的代码
final byte delimiter = 10;
stopWorker = false;
readBufferPosition = 0;
readBuffer = new byte[1024];
workerThread = new Thread(new Runnable() {
public void run() {
while (!Thread.currentThread().isInterrupted() && !stopWorker) {
try {
int bytesAvailable = inputStream.available();
if (bytesAvailable > 0) {
byte[] packetBytes = new byte[bytesAvailable];
inputStream.read(packetBytes);
for (int i = 0; i < bytesAvailable; i++) {
byte b = packetBytes[i];
if (b == delimiter) {
byte[] encodedBytes = new byte[readBufferPosition];
System.arraycopy(
readBuffer, 0,
encodedBytes, 0,
encodedBytes.length
);
// specify US-ASCII encoding
final String data = new String(encodedBytes, "UTF-8");
readBufferPosition = 0;
此处没有有关正在打印的格式的信息。您还需要格式化标签以使用 UTF-8。
请参阅: ZPL 打印机上的 Unicode 字符