开发者

iText encoding problem

I have encoding problem with iText (http://www.lowagie.com/iText/). I load data from database and insert it as html to pdf with iText, for some reason my non-english (Finnish ä,ö etc) characters don't show up correctly. Following example shows开发者_StackOverflow how insert text to html:

    text = "<p>" + data + "</p>";
    HTMLWorker htmlWorker = new HTMLWorker(doc);
    InputStream is = new ByteArrayInputStream(text.getBytes());
    InputStreamReader isr = new InputStreamReader(is);
    htmlWorker.parse(isr);  

UPDATE: If have to add that it's working in my Windows Vista system, but not in Linux system.


Is your default Locale set properly? Make sure that Locale.getDefault() is returning the value it should be. This could be different on windows and linux, if one of them hasn't been set up correctly.


Try using InputStreamReader with appriopriate charset name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜