问题
long story short, i have implemented an android restaurant application that runs on blue stacks 4, the app has a printing functionality that uses an Ethernet connection to print the receipts from a thermal printer.
the printer is set correctly as for now it prints test pages and receipts in English, but it does not print non-English words.
what i tried so far :
String str = new String("تعطي يونيكود رقما فريدا لكل حرف".getBytes(), "UTF-8"); and every other utf/iso related formatting but non seem to work
what i concluded so far : the printer prints on a c# programs. the printer is set up correctly. its not from the bluestacks default language.
and here is the code implemented in the function.
try {
Socket socket = new Socket("192.168.123.101", 9100);
PrintWriter pw = new PrintWriter(socket.getOutputStream());
String s= new String("محمد الزعبي".getBytes(),"UTF-8") ;
pw.println(s);
pw.println("\n\n\n\f");
pw.close();
socket.close();
} catch (Exception e) {
new AlertDialog.Builder(Emppage.this).setMessage("error: "+e).show();
}
来源:https://stackoverflow.com/questions/58153029/android-java-with-thermal-printer-and-blue-stacks-does-not-print-non-english-w