Hi. I have a problem with with unicode characters in generated pdf. Everything works fine on my own workstation, but at the test environment things go wrong. Code inserting value is following:
Font boldDefaultFont = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD);
// ...
PdfPCell headerCell = new PdfPCell();
// unit.getName() returns "°C"
Phrase header = new Phrase(unit.getName(), boldDefaultFont);
headerCell.addElement(header);
Java source code is in UTF-8.
When this is run in my environment (java 1.6.0_18, WinXP) cell contains °C
as I would expect, but in test-environment (java 1.6.0_18, Win2003) result is °C
. I've figured out that this is a encoding-problem (UTF-8 '°' is 0xc2b0 which equals '°' in iso-8859-1).
For now I've tried following:
1) adding -Dfile.encoding=utf8
to java options (no effect in either environment)
2) adding ARIALUNI.TTF to test environments C:\WINDOWS\Fonts (no effect)
3) encoding unit.getName() to iso-8859-1, but it made the degree sing disappear in my machine.
Environment that views the pdf has no effect, pdf generated on my workstation shows nicely everywhere and vice versa.
Does anyone have experience on this subject? I bet there is a way to get this working in both environments.