I have a spreadsheet (.xls) with car plate numbers in encoding windows-1252, BUT originally those numbers were inputted in cyrillic in encoding UTF-8. What I mean: i.e. У992НВ in cyrillic is the same Y992HB in latin (there is a difference between first letters) So, I take those numbers and convert it
if (cell.getCellType() == CellType.STRING) {
String cellValue = cell.getStringCellValue();
try {
byte[] b = cellValue.getBytes("windows-1252");
String cellValue2 = new String(b, StandardCharsets.UTF_8);
cell.setCellValue(cellValue2);
}
catch ( UnsupportedEncodingException ex) {
}
But, output is wrong. Input data in windows-1252 is "Т313ÐК777" and output is Т313�К777, because middle sign is unreadable. What am I doing wrong?