【问题标题】:Using special characters in Velocity templates在 Velocity 模板中使用特殊字符
【发布时间】:2019-11-14 07:16:49
【问题描述】:

我正在尝试在 Velocity 模板中使用破折号 (—) 和乘法符号 (×)。但是输出给出了以下内容。

- 用于破折号

× 表示乘法符号

我也在<head/> 中添加了<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

我也尝试使用以下内容。

#set( $multiplySymbol = '×' )

但它给出了相同的输出。

如何在 Velocity 上使用这些特殊字符?

【问题讨论】:

标签: velocity


【解决方案1】:

获取模板vm文件时使用如下。

Template template = Velocity.getTemplate("template.vm", "UTF-8");

谢谢@user7294900

【讨论】:

    猜你喜欢
    • 2014-07-16
    • 1970-01-01
    • 1970-01-01
    • 2014-01-16
    • 1970-01-01
    • 1970-01-01
    • 2018-03-18
    • 2011-11-15
    • 1970-01-01
    相关资源
    最近更新 更多