I am trying to print arabic string in escpos from android java. But only some chinese characters are printing. My printer supports arabic language.
Here my code
private void printArabic() throws IOException {
String print ="الجحيم";
ByteBuffer init = ByteBuffer.allocate(2);
init.put((byte) 0x1B);
init.put((byte) 0x25);
sendData(init.array(), outputStream);
ByteBuffer dataToPrint = ByteBuffer.allocate(print.length());
dataToPrint.put(print.getBytes("cp864"));
sendData(dataToPrint.array(), outputStream);
}
private void sendData(byte[] buffer, OutputStream os) throws IOException
{
try {
ByteBuffer byteBuffer = ByteBuffer.wrap(buffer);
os.write(byteBuffer.array());
os.flush();
// tell the user data were sent
} catch (Exception e) {
e.printStackTrace();
}
}
It will be helpfull if someone can suggest any code sample.