Java Mailing List Archive

http://www.junlu.com/

Home » FreeMarker-user »

Re: [FreeMarker-user] ?js_string double escapes - is this wanted ?

Denis

2011-12-09

Replies: Find Java Web Hosting

Author LoginPost Reply

>> Hello Grégory
>>
>> How do you suggest handling backslash (\) in the input then? Do you want FreeMarker to check if the next character is a quote? How about \""?
>
> Treat them the same way ? If whatever after a backslash is something we'd prepend with a backslash, then just ignore that ?

However \"" is not escaped text, as it contains an unescaped quote.

Consider:
input -> escaped -> unescaped
\\a -> \\\\a -> \\a
\\\a -> \\\\a -> \\a
"a" -> \"a\" -> "a"
\"a" -> \"a\" -> "a"

With current js_string, the unescaped string is the same as the input string. Your proposition would break this.

Can't you just repeat unescape twice?

-- Denis.

>
>> That sounds unsafe.
>>
>> -- Denis.
>>
>>> Hi there,
>>>
>>> Just noticed that ${"don't do this"?js_string?js_string} would output "don\\'t do this". Shouldn't the built-in be smart enough to notice when quotes are already escaped ? Or is there a good reason for this ?
>>>
>>> I'd rather it doesn't double-escape, so I can add ?js_string to my templates safely, even if some of the model's code is already doing escaping for some reason.
>>>
>>> Thoughts ?
>>>
>>> Cheers,
>>>
>>> -greg
>>>
>>> ------------------------------------------------------------------------------
>>> Cloud Services Checklist: Pricing and Packaging Optimization
>>> This white paper is intended to serve as a reference, checklist and point of
>>> discussion for anyone considering optimizing the pricing and packaging model
>>> of a cloud services business. Read Now!
>>> http://www.accelacomm.com/jaw/sfnl/114/51491232/
>>> _______________________________________________
>>> FreeMarker-user mailing list
>>> FreeMarker-user@(protected)
>>> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>>
>> ------------------------------------------------------------------------------
>> Cloud Services Checklist: Pricing and Packaging Optimization
>> This white paper is intended to serve as a reference, checklist and point of
>> discussion for anyone considering optimizing the pricing and packaging model
>> of a cloud services business. Read Now!
>> http://www.accelacomm.com/jaw/sfnl/114/51491232/
>> _______________________________________________
>> FreeMarker-user mailing list
>> FreeMarker-user@(protected)
>> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>
>
>
> ------------------------------------------------------------------------------
> Cloud Services Checklist: Pricing and Packaging Optimization
> This white paper is intended to serve as a reference, checklist and point of
> discussion for anyone considering optimizing the pricing and packaging model
> of a cloud services business. Read Now!
> http://www.accelacomm.com/jaw/sfnl/114/51491232/
> _______________________________________________
> FreeMarker-user mailing list
> FreeMarker-user@(protected)
> https://lists.sourceforge.net/lists/listinfo/freemarker-user

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of
discussion for anyone considering optimizing the pricing and packaging model
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
FreeMarker-user mailing list
FreeMarker-user@(protected)
https://lists.sourceforge.net/lists/listinfo/freemarker-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.