is it possible to encode the output html as UTF-8 instead of windows-1252?

750 views
Skip to first unread message

xiaoy...@gmail.com

unread,
Mar 22, 2017, 1:52:49 PM3/22/17
to xnat_discussion
Hi all,

I have cloned the latest version of XNAT and compile to excute locally. I tried ways to customize the words of views into Chinese but fail. 
I looked up the official velocity document(http://velocity.apache.org/engine/devel/developer-guide.html#template-encoding-for-internationalization), and tried to change the velocity source code like this:

input.encoding=UTF-8
output.encoding=UTF-8
contentType=text/html
charset=UTF-8

and I also added a meta tag at head <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"  pageEncoding="UTF-8"> but it still doesn't work.
Then I realize that it seems to be supposed to change spring configuration but I can not find the location in the source code(seems not exist). I can only find velocity initialization and vm loader in the jar packge.

velocity init: /home/xiaoyu/.gradle/caches/modules-2/files-2.1/org.nrg.xdat/core/1.7.3-SNAPSHOT/6a3d169e5dbeed7d5cf57418b2d3ac91bd470187/core-1.7.3-SNAPSHOT-sources.jar!/org/nrg/xft/utils/VelocityUtils.java
vm loader: /home/xiaoyu/.gradle/caches/modules-2/files-2.1/org.nrg.xdat/core/1.7.3-SNAPSHOT/6a3d169e5dbeed7d5cf57418b2d3ac91bd470187/core-1.7.3-SNAPSHOT-sources.jar!/org/nrg/xdat/velocity/loaders/CustomClasspathResourceLoader.java

Is there any solution anyone can provide? And I make sure it's UTF-8 encoding in the template and my IDEA.


Thx for your time.
Xiaoyu

xiaoy...@gmail.com

unread,
Mar 23, 2017, 10:08:42 AM3/23/17
to xnat_discussion
Anyway, the problem has been solved after I add these code to TurbineResources.properties:

services.VelocityService.output.encoding=UTF-8
services.VelocityService.input.encoding=UTF-8
services.VelocityService.default.contentType=text/html; charset=utf-8
input.encoding=UTF-8
output.encoding=UTF-8
locale.default.charset=UTF-8

and add "-Dfile.encoding=UTF-8" to my comcat configuration.
Reply all
Reply to author
Forward
0 new messages