[
https://issues.apache.org/jira/browse/VELOCITY-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12475562
]
Christopher Schultz commented on VELOCITY-519:
----------------------------------------------
Stepan,
The only reason that Java needs unicode escaping in source files is because
java source files are defined to be ISO-8859-1. You simply cannot put higher
characters like Kanji into a Java source file, hence the \u1234 escape
sequences. Same thing with properties files.
Velocity template files have no such restrictions IIRC. Why not simply use
UTF-8 encoding and put your special characters directly into your template
files? There's really no need for escaping of these kinds of things.
Now, newline escaping is another story, unless there is a non '\n' (or '\r')
newline character that I don't know about.
> 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
>
>
> 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]