Reputation: 431
I am new at using velocity templates and in a few I have created, most of the templates work fine but if I add different characters to the templates it sometimes does not work.
How do you know what characters velocity templates allow?
Upvotes: 0
Views: 2251
Reputation: 20726
As you didn't really provide too much details, it is a bit hard to help blindly, but having been in the same trousers myself, my 0xFF
th sense feels that you have troubles with the default encoding being different than that of the template.
You should explicitly specify encoding wherever possible, and in this case it is possible. Use the encoding
parameters when using the templates to supply the required encoding using the functions in org.apache.velocity.app.Velocity
class:
public static Template getTemplate(String name, String encoding);
public static boolean mergeTemplate( String templateName, String encoding, Context context, Writer writer );
Instead of the functions omitting the encoding
parameter:
Recommended reading:
Upvotes: 2