撇号的速度模板问题
我正在使用 Velocity 模板,当我使用带撇号的变量时,即:
$用户的
其中“user”是变量名,我得到翻译后的变量值,但撇号变成了一堆问号。例如,如果“user”的值为“Mary Ann”,我会得到:
玛丽·安???
如何“转义”撇号,以便 Velocity mergeTemplate 方法不会产生此输出?顺便说一句,我发送到该方法的编码是 iso-8859-1:
Velocity.mergeTemplate(模板,TEMPLATE_ENCODING,上下文,string_writer);
虽然我们没有 Velocity 属性文件,但据我了解,这是默认的 Velocity 编码。
任何反馈将不胜感激。
更新:我可以在 HTML 模板中使用编码 amp#39;
但在文本模板中仍然遇到相同的问题
I am using a Velocity template, and when I use a variable with an apostrophe, i.e.:
$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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果此模板在 HTML 上下文中使用,您可以使用
’
If this template used in context of HTML you can use
’