Re: URL encoding and the "+" char
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Wednesday, June 2, 2010, 12:08:39 AM, Dan Washusen wrote:
> Hey All,
> I'm attempting to add a base64 encoded string as a URL parameter in a FM template.
>
> <a id="activate" href="action?token=${token?url}">Click Here</a>
>
> This works fine but it appears that the Freemarker URL encoding
> doesn't encode the "+" chars contained in the token. When I attempt
> to decode the token using either commons-codec or the
> java.util.URLDecoder the "+" is replaced by a space (" ") and my token is corrupt.
>
> So I guess my question is; is this a bug or a feature?
That would be a major bug, as ?url is for escaping query parameters.
But for me it works. This is the template I tried:
<#setting url_escaping_charset='utf-8'>
${.version}
${"a/b+c d"?url}
and its output was:
2.3.16
a%2Fb%2Bc%20d
What is the output on your setup? (Note that I didn't even find any
version history entry that says that ?url had a bug in earlier
FreeMarker versions.)
> Cheers,
> Dan
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------