Velocity templates seem to fail with UTF-8
- by steve
Hi,
i have been trying to use a velocity Template with the following content:
Sübjäct $item
everything works fine except the translation of the tow unicode characters. The result string printed on the commandline looks like:
Sübjäct foo
I searched the velocity website and the web an this issue, and came uo with differnt font encoding options, which i added to my code. But those won't help. This is the actuall code:
velocity.setProperty("file.resource.loader.path", absPath);
velocity.setProperty("input.encoding", "UTF-8");
velocity.setProperty("output.encoding", "UTF-8");
Template t = velocity.getTemplate("subject.vm");
t.setEncoding("UTF-8");
StringWriter sw = new StringWriter();
t.merge(null, sw);
System.out.println(sw.getBuffer());
Can anyone give me some hints, how to fix this issue?