Re: URL encoding and the "+" char

Dan Washusen <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
My bad!

The FM url encoding works fine... I was double decoding the activate link by
doing "new URI(link).getQuery()" and then using commons codec.  As it turns
out the URI instance was decoding the query part...

On 2 June 2010 17:54, Daniel Dekany <[email protected]> wrote:

> 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
>
>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.