You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Henning Schmiedehausen (JIRA)" <ji...@apache.org> on 2006/11/06 21:58:40 UTC

[jira] Resolved: (VELOCITY-366) Need verification of velocity templates to assure that non-UTF-8 characters are flagged for repair

     [ http://issues.apache.org/jira/browse/VELOCITY-366?page=all ]

Henning Schmiedehausen resolved VELOCITY-366.
---------------------------------------------

    Resolution: Cannot Reproduce

Ok, so this is what I did: 

I prepared two files, both contain umlauts, one in ISO, one in UTF-8 encoding. I verified that both files really contain characters in that encoding (ah, the joys of emacs). 

I iterated through all combinations of input.encoding and output encoding in velocity properties for a VelocityViewServlet with the following results: 

- When the input.encoding is set correctly, the corresponding file is read correctly. 
- When the output.encoding is set, the resulting page will have that encoding, no matter what the input encoding was. As long as input.encoding and the actual charset match, the result will be correctly encoded.

If you set the input and output encoding to e.g. ISO-8859 and then try to process an UTF-8 template, then the result will contain UTF-8 characters. This is not Velocity's fault but a configuration error. If you set input.encoding to UTF-8, then the umlauts will be correctly converted to iso.

So, for me, the conversion of chars does work. It might be possible that this was broken in earlier versions (actually doubt it) or that you simply mixed up file encodings and input and output encodings. Yes, multi-charset support is not really strong in Velocity, so I would recommend using UTF-8 everywhere (unfortunately then you do have to add the encoding to the properties file, because the default is iso-8859-1



> Need verification of velocity templates to assure that non-UTF-8 characters are flagged for repair
> --------------------------------------------------------------------------------------------------
>
>                 Key: VELOCITY-366
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-366
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.4
>         Environment: Operating System: Linux
> Platform: All
>            Reporter: Ilango
>         Assigned To: Henning Schmiedehausen
>             Fix For: 1.5
>
>
> There seem to be problem in interpolating the template when we add non-UTF
> characters in the velocity templates. 
> A typical synario where we faced this issue was that a welcome message e-mail
> (velocity template) was missing the content portion as it contained the
> charecter "". We could reproduce the problem consistently by adding this
> charecter in the velocity template.
> It would be great if we get velocity to handle these type of data as there is a
> possibility of making the contents look weird otherwise.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org