I am making an app that uses fiscal printer, and the document that i send to the printer must be in Cyrillic. The problem is that one specific character (one for the tariff group because i am trying to print out a receipt) should be (char)192
, but somehow in the process gets changed to some random character. I've tried changing the encoding of the project to UTF-8 under Project>Properties>Resource>Text file encoding and nothing changed. I've also tried changing the encoding in Window>Preferences>General>Workspace>Text file encoding to UTF-8 and still nothing.
Note: when I type the document manually on other machines and then send it to the fiscal printer it works fine (but not on my pc though). I use notepad to edit the file the output file type is .in.
Here is the code
if(result==JOptionPane.YES_OPTION){
try {
PrintWriter writer;
writer = new PrintWriter("PF500.in");
String line1 = " 01,0000,1";
writer.println(line1);
String etq = "#1";
String line2 = null;
String tarifa = null;
for(Artikli art : list){
switch(etq){
case "#1": etq = "$1";
break;
default: etq = "#1";
}
switch(art.tarifa){
case "0801": tarifa = Character.toString((char)192);
break;
case "0701": tarifa = Character.toString((char)193);
break;
case "0601": tarifa = Character.toString((char)194);
break;
}
line2 = etq + art.name.trim() + Character.toString((char)9) + tarifa + art.cena + "*" + art.kolicina;
writer.println(line2);
}
writer.println("%5" + Character.toString((char)9) + "P" + String.valueOf(total));
writer.println("#" + Character.toString((char)56));
writer.close();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
con.clearSmetka(id);
con.insertIzvestaj(list, den.date, id, user.name, time, popust);
dtm1.setRowCount(0);
smetkaTable.setModel(dtm1);
btnCloseSmetka.setEnabled(false);
btn.setBackground(new Color(0, 128, 128));
btn.setText("Маса " + String.valueOf(id));
smetkaTxt.setText("0,00");
workFrame.dispose();
}
Everything works fine except the character for the tariff group (which is (char)192)