I am using a Velocity template, and when I use a variable with an apostrophe, ie:
$user's
where "user" is the variable name, I get the value for the variable translated, but the apostrophe turns into a bunch of question marks. For instance, if the value for "user" was "Mary Ann," I'd get this:
Mary Ann????s
How can I "escape" the apostrophe so that the Velocity mergeTemplate method will not produce this output? BTW, the encoding that I'm sending to that method is iso-8859-1 :
Velocity.mergeTemplate(template, TEMPLATE_ENCODING, context, string_writer);
Although we don't have a Velocity properties file, it's my understanding that this is the default Velocity encoding.
Any feedback would be greatly appreciated.
UPDATE: I can use the encoding amp#39;
in the HTML template but I still have the same issue in the text template
如果此模板用于HTML上下文,则可以使用’
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.