How to convert UTF-8 String to String US-ASCI codepage 437 when send String to bluetooth printer who is with embeded codepage CP437 US-ASCII from Android studio?
I'm new to Android studio. I have little bit older POS printer with bluetooth. In my app I send to printer some strings for example the name of articles ( items) . Strings are in UTF-8 format from date base and also in utf-8 in String variables in Android Studio. POS printer have embedded codepage CP437 , US-ASCI. How I can transform string variable from UTF-8 to CP437 US-ASCI or replace only special character for example Š,š,Č,č,Ć,ć,Đ,đ,Ž,ž with another, etc S,s,C,c,D,d,Z,z... or maybi define my own nice (normal) visiably character before send to printer .
Thank You very much for answers...
I tray on this way, but it not work good. Print results are hieroglyphics for special letters...
nameitem=substring(format("%1$"+ (-18)+"s",somearray[0]),0,18);
byte[] b= nameitem.getBytes("UTF-8");
nameitem = substring(new String(b, StandardCharsets.US_ASCII),0,18);
doprint(nameitem);
On printer I have hieroglyphics results for that chars(letters) etc: ?1/2ß÷×~a.... I wish to have CcScD.. Or maybe in best solution, defined on some own way graphically Č抚Đ...