閱讀718 返回首頁    go 阿裏雲 go 技術社區[雲棲]


Apache Velocity官方指南-12.模板編碼及國際化

Velocity允許你指定模板的字符集編碼,並且非常簡單。常用的resource API已經支持把編碼作為入參。代碼如下:


org.apache.velocity.app.Velocity:
public static Template getTemplate(String name, String encoding)
public static boolean mergeTemplate( String templateName, String encoding, Context context, Writer writer )

參數encoding的值是JVM支持的常用編碼,比如”UTF-8″ 或者”ISO-8859-1″,如果想知道一些字符編碼集的正式名稱,從這裏查表

注意:這兩個方法僅僅應用在讀入模板的時候,至於輸出的編碼格式就是應用程序本身需要處理的問題了。

最後更新:2017-05-22 16:37:34

  上一篇:go  軟件事務內存導論(二)軟件事務內存
  下一篇:go  Velocity官方指南-Velocity是如何工作的