I have a bluetooth printer and I print english characters from my android app normally, but when I write Arabic characters its print them incorrectly. I try to encode outputstream when write to the printer but no result. this is my code
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter
.getBondedDevices();
if (pairedDevices.size() > 0) {
for (BluetoothDevice device : pairedDevices) {
if (device.getName().equalsIgnoreCase("BlueTooth Printer")) {
mmDevice = device;
break;
}
}
}
this is how i print data:
void sendData() throws IOException {
try {
// the text typed by the user
String msg = myTextbox.getText().toString();
msg += "\n";
mmOutputStream.write(msg.getBytes(Charset.forName("UTF-8")));
// tell the user data were sent
myLabel.setText("Data Sent");
} catch (NullPointerException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}