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

Will Glass-Husain commented on VELOCITY-519:
--------------------------------------------

Stepan makes good points (I believe) about the utility of including escaped 
unicode characters.  Actually, I face similar issues from time to time.  My 
main text editor doesn't do a good job with UTF-8.

I advocate \n, \r, and more importantly, \t for comprehensiveness.  If we allow 
unicode escaping then users will expect the other items.   Are there more that 
need to be included?

I can imagine cases where inserting a tab character might be useful.  For 
example, you might want to compare a string to \t in an #if statement.  The 
following

#if($samplestring.contains("\t"))

is more readable than

#if($samplestring.contains("\t"))

You could do this with a tool, but this is simpler syntax.

WILL


> 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