[ 
https://issues.apache.org/jira/browse/VELOCITY-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12475572
 ] 

Stepan Koltsov commented on VELOCITY-519:
-----------------------------------------

Christopher,

It is not easy to work with some UTF-8 characters in Velocity template. For 
example, it is hard to maintain code with em dash in text editor with fixed 
width font. With some unicode characters, like non-breakable space, it is not 
possible to work in the most text editors.

BTW, you are not right, that java mandates ISO-8859-1:

[EMAIL PROTECTED]:...ft/velocity/engine-trunk]% javac -help |& grep encoding    
                                   
  -encoding <encoding>       Specify character encoding used by source files

Another reason for unicode escapes is that my company mandates that all source 
files must be in windows-1251.

I personally don't need \r or \n escapes, but I think they should be enabled in 
version 2.0.

> Java escape sequences should work in Velocity macros
> ----------------------------------------------------
>
>                 Key: VELOCITY-519
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-519
>             Project: Velocity
>          Issue Type: New Feature
>    Affects Versions: 1.5 beta2
>            Reporter: Stepan Koltsov
>         Attachments: velocity-unescape-2007-02-24-stepancheg.diff, 
> velocity-unescape-only-u-2007-02-24-stepancheg.diff
>
>
> Following test should work:
> ===
>     public void testJavaEscape() throws Exception {
>         VelocityEngine ve = new VelocityEngine();
>         ve.init();
>         Context context = new VelocityContext();
>         StringWriter writer = new StringWriter();
>         ve.evaluate(context, writer, "test","#set($v = \"\\u0061\")$v");
>         assertEquals("a", writer.toString());
>         writer = new StringWriter();
>         ve.evaluate(context, writer, "test","#set($v = \"\\n\")$v");
>         assertEquals("\n", writer.toString());
>     }
> ===

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to