when I try to send text content to my thermal printer it gives me the chinese symbols in case of Arabic and in case in English it give me the correct phrase
could you help me with this problem this is image that describe what I mean :
I thought firstly that my printer didn’t support Arabic but when I Used this app to send Arabic content it printed successfully
this is my function block :
@SimpleFunction(description = "encode text")
public static List<Byte> generatePrintCommand(String charset, String text, boolean changeFont, int size, boolean bold, boolean underline, boolean feedline) {
List<Byte> command = new ArrayList<>();
// Set character encoding
command.add((byte) 27);
command.add((byte) 116);
command.add((byte) charset.getBytes()[0]);
// Add text to print
command.add((byte) 27);
command.add((byte) 33);
int font = (changeFont ? 1 : 0) + (size << 2) + (bold ? 8 : 0) + (underline ? 128 : 0);
command.add((byte) font);
byte[] textBytes = text.getBytes();
for (byte b : textBytes) {
command.add(b);
}
// Feed line after printing
if (feedline) {
command.add((byte) 10);
command.add((byte) 13);
}
return command;
}
this what I tried after connecting with printer :