You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by soumyanilchatterjee <so...@3i-infotech.com> on 2010/07/02 11:20:39 UTC
Encoding problem in velocity
Hi ,
I am using velocity engine to read a template and and generate a document
like the template,but i have a problem that if my data is russian(Cyrllic)
then data is coming as junk.The same code runs fine in windows.I have set
input.encoding=windows-1251,output.encoding=windows-1251 as well as
ISO--8859-5 in velocity.properties file,but it didn't work in unix
enviornment.Could u please help.any clarification needed kindly revert back.
--
View this message in context: http://old.nabble.com/Encoding-problem-in-velocity-tp29053984p29053984.html
Sent from the Velocity - User mailing list archive at Nabble.com.
Re: Encoding problem in velocity
Posted by mailmur <ma...@yahoo.com>.
This is year 2010 all should use nothing but unicode file encodings and html reply encodings. Unfortunately Velocity and Java does not use utf-8 as a default setting, and not all velocity resource loaders support it.
I always recommend using FileResourceLoader and its use of UTF-8withBOM file reader.
http://svn.apache.org/repos/asf/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
Use "unicode=true" setting in a velocity.properties loader configuration, save .vm files as UTF-8 with BOM marker. Its essential to use a bom marker to distinguish proper encoding within a file itself.
ps: Here is an old but still valid document of the utf-8 state in Java environment.
http://koti.mbnet.fi/akini/java/unicodereader/
----- Original Message ----
From: soumyanilchatterjee <so...@3i-infotech.com>
To: user@velocity.apache.org
Sent: Fri, July 2, 2010 12:20:39 PM
Subject: Encoding problem in velocity
Hi ,
I am using velocity engine to read a template and and generate a document
like the template,but i have a problem that if my data is russian(Cyrllic)
then data is coming as junk.The same code runs fine in windows.I have set
input.encoding=windows-1251,output.encoding=windows-1251 as well as
ISO--8859-5 in velocity.properties file,but it didn't work in unix
enviornment.Could u please help.any clarification needed kindly revert back.
--
View this message in context: http://old.nabble.com/Encoding-problem-in-velocity-tp29053984p29053984.html
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: Encoding problem in velocity
Posted by soumyanilchatterjee <so...@3i-infotech.com>.
I am using RTFtemplate is it possible to use FileResourceLoader with
RTFTemplate? as in normal template I have to getTemplate,but in RtfTemplate
we have to do engine.createTemplate(Filepath);
Kindly advise
--
View this message in context: http://old.nabble.com/Encoding-problem-in-velocity-tp29053984p29072806.html
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org