I am trying to get rtf formatted text from database and get plain text out of it but i am having trouble with some of polish letters. Not all of them just few. In database there is stored line which looks like this:
{\rtf1\ansi\ansicpg1250\deff0\deflang1045{\fonttbl{\f0\fnil\fcharset238 Microsoft Sans Serif;}} \viewkind4\uc1\pard\f0\fs17 Raport s\'b3u\'bfy do kontroli kwot na fakturach.\par Wy\'b3apuje rozbie\'bfno\'9cci w kwotach por\'f3wnuj\'b9c warto\'9cci z tabelek InvoiceDetail i AccountSettlement\par }
after getting it out of database i store it in String then i use this method:
private String rtfDecode(String input) {
try{
RTFEditorKit rtfParser = new RTFEditorKit();
Document document = rtfParser.createDefaultDocument();
rtfParser.read(new ByteArrayInputStream(input.getBytes()), document, 0);
String text = document.getText(0, document.getLength());
return text;
}catch (IOException e){
System.out.println(e.toString());
}catch (Exception e){
System.out.println(e.toString());
}
return null;
}
Most part seems to be fine but i am loosing polish letters
Raport s³u¿y do kontroli kwot na fakturach.
Wy³apuje rozbie¿ności w kwotach porównuj¹c wartości z tabelek InvoiceDetail i AccountSettlement
It should look like this
Raport służy.....
I think i am doing something wrong with coding but i cant find what is the problem