java - Velocity templates seem to fail with UTF-8 -
i have been trying use velocity template following content:
sübjäct $item
everything works fine except translation of 2 unicode characters. result string printed on command line looks like:
sübjäct foo
i searched velocity website , web issue, , came different font encoding options, added code. these don't help. actual 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());
how fix issue?
have tried using:
template template = velocity.gettemplate("subject.vm", "utf-8");
? looks should right thing.
Comments
Post a Comment