PHP has internal functions specifically for this purpose.  You'll want
to take a look at rawurlencode/urlencode and rawurldecode/urldecode,
as well as htmlentities, html_entity_decode, and htmlspecialchars and
htmlspecialchars_decode for future issues such as this.

On Nov 21, 4:56 am, Oliver <[EMAIL PROTECTED]> wrote:
> Hi Grigri ,
>
> thanks a lot for explaining the issue, makes it totally obvious.
> Actually after writing my post I saw another thread tackling also a
> parameter issue. They used the usual GET ?key=value mechanism and
> because this is basically a user id for a initial request, I though it
> may be a good idea to let Google know that it isn't worth searching
> the URL. So I tried the usual GET parameters and I had my plus sign
> back :)
>
> But thanks anyway for giving me something to read and some more
> insight. It's probably useful for anytime later.
>
> Cheers,
>   Oliver
>
> On Nov 21, 10:39 am, grigri <[EMAIL PROTECTED]> wrote:
>
>
>
> > This has very little to do with cake.
>
> > A URI has reserved characters which must be escaped (see RFC 3305).
> > The data (query part of the URI) of a GET request is interpreted as
> > the mime type `application/x-www-form-urlencoded` which has some
> > legacy encoding rules, including the substition of + for a space.
>
> > Seehttp://en.wikipedia.org/wiki/Percent-encodingformore details.
>
> > While you might argue that your data is technically in the path part
> > of the uri, not in the query part, cakephp's .htaccess file encodes
> > all path data to a query value called 'url', so it is then subject to
> > those nasty legacy rules. This behavior is not specific to cakephp;
> > it's very widespread.
>
> > I'm not sure what you can do about your specific problem. I've never
> > ran into it; the closest I got was when I wanted to process '+' and
> > '-' characters to sort data (eg: '/sort:+title-price+whatever', and I
> > achieved that by treating a space as a plus character.
>
> > Sounds like a thorny issue though; how do you tell if the space was
> > meant to be a space or a plus? Can you check any of the following
> > server variables and get the correct result?
>
> >  $_SERVER['REDIRECT_QUERY_STRING'];
> >  $_SERVER['REDIRECT_URL'];
> >  $_SERVER['REQUEST_URI'];
>
> > For me (Apache 2.2, PHP 5.2.6), using the following url, I get these
> > results
>
> > URL (typed) "http://localhost/website/controller/test:one+two-three/
> > this:has a space"
>
> > [REDIRECT_QUERY_STRING] => url=controller/test:one+two-three/this:has
> > a space
> > [REDIRECT_URL] => /website/app/webroot/controller/test:one+two-three/
> > this:has a space
> > [QUERY_STRING] => url=controller/test:one+two-three/this:has a space
> > [REQUEST_URI] => /website/controller/test:one+two-three/this:has%20a
> > %20space
>
> > So it must be possible to get the correct parameters, if this works
> > the same way on all servers.
>
> > hth
> > grigri
>
> > On Nov 21, 6:16 am, Oliver <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > I've a problem where I pass parameter using GET to an action that
> > > contains a plus ("+") sign. It will always get replaced by a space
> > > character before becoming accessible in the action. Everything I've
> > > tried failed, either using the different types to pass the parameter
> > > (names, etc). I haven't tried a POST yet but wanted to ask here if
> > > this is a known and wanted behavior or if I may have run into a bug.
>
> > > Here an example of a url I try to call:
>
> > > blah.com/profiles/import/Y%2bI6hLyjY7ryHiwIHenWYg%3d%3d
>
> > > Here the result when printing the params array:
>
> > > Array ( [url] => profiles/import/Y I6hLyjY7ryHiwIHenWYg== )
>
> > > It doesn't help if I provide the parameter in decoded form, same
> > > result.
>
> > > I'm using 1.2 RC3.
>
> > > Any help highly appreciated!
>
> > > Thanks,
> > >   Oliver- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to