If you put a URL into some HTML, you should HTML escape it. Yes, this is strange. I wrote about it here:
http://jjinux.blogspot.com/2006/03/html-escaping-s-in-urls-in-html.html Best Regards, -jj On Thu, Jun 19, 2008 at 11:48 AM, Tom <[EMAIL PROTECTED]> wrote: > Just wanted to update anyone who comes across this and needs a (bad) > solution. I managed to get this to work using something quite ugly. > Instead of: > > redirect_to(controller='page', action='index', title=title) > > I used: > > redirect_to('/page/index/'+str(title)) > > Getting rid of the str() in the second one or adding str() to the > first one did not work. > > On Jun 19, 1:28 pm, Tom <[EMAIL PROTECTED]> wrote: >> I've come across an issue involving the use of '+' and '%20' for >> representing spaces in a URL. >> >> Many apps treat the plus sign and the %20 code the same, however >> pylons does not. Lets say you have a def which takes in one argument, >> lets call it 'title', sets it as c.title, and a mako template that >> prints c.title. >> >> If your title string is "foo+bar", mako renders the string "foo+bar", >> whereas if your title string is "foo%20bar", it renders "foo bar". >> Generally, this isn't much of an issue, as one can make URLs that have >> %20 instead of +, however the redirect_to() function in pylons changes >> spaces to "+" and not "%20". >> >> So my question is, is there a way to change how redirect_to encodes >> strings? I've tried changing spaces to "%20" prior to passing it to >> redirect_to, but all that happens is that the "%" sign gets encoded >> itself and "%20" shows up as part of the title. >> >> Thanks. > > > -- I, for one, welcome our new Facebook overlords! http://jjinux.blogspot.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
