[
https://issues.apache.org/jira/browse/VELOCITY-587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568208#action_12568208
]
Nathan Bubna commented on VELOCITY-587:
---------------------------------------
We've had a lot of debates on escaping issues over the years. Feel free to
search the archives if you'd like to be caught up on the various arguments.
But perhaps it will suffice to point out that the only escaping solutions for
strings (double or single quoted) that we have ever achieved a consensus on are
VELOCITY-520 and VELOCITY-555. 520 was quickly patched, but sadly, Geir never
shared the patch for 555 and no one has stepped up to implement it themselves
yet.
Things like VELOCITY-519 may be considered if/when someone starts work on
Velocity Engine 2.0, but not before. And when that time comes, you can be sure
that i will always be loudly advocating for the maximum possible consistency
between parsing done in interpolated strings and parsing done elsewhere. If we
do make the backslash a general escape character, you can bet i'll argue to
have it work the same everywhere. :)
> Backslashes throw lexical errors in double-quoted strings
> ---------------------------------------------------------
>
> Key: VELOCITY-587
> URL: https://issues.apache.org/jira/browse/VELOCITY-587
> Project: Velocity
> Issue Type: Bug
> Affects Versions: 1.6
> Reporter: Jon Seymour
> Priority: Minor
> Fix For: 1.6
>
>
> The VTL doesn't currently provide a way to express strings containing a
> single backslash (\)
> #set($backslash="\")
> results in a lexical error during template parsing.
> #set($backslash="\\")
> results in $backslash being assigned a string containing two backslashes (\\)
> It appears the only workaround available now is to construct a variable
> containing just a single backslash with this idiom:
> #set($twobackslashes="\\")
> #set($backslash=$twobackslashes.substring(0,1))
> Even if this can't be fixed in the parser, the documentation should be
> updated to define a preferred idiom for obtaining a string containing a
> single backslash.
> jon.
> note: this issue partially duplicates a comment by Guido Deinhammer on issue
> #454 regarding other escaping issues. I have raised a separate issue, so that
> this one can be addressed separately, if desired.
--
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]