List Info

Thread: Re: + in GET param




Re: + in GET param
user name
2007-09-11 09:16:19
On 11/09/2007, Gavin Henry <ghenryperl.me.uk> wrote:
> Dear list,
>
> I have created a url via uri_for that produces (hashref
passed in):
>
>      http://myserver.com/blah/?username=first.last%2Bme
%40gmail.com
>
> so the + is escaped into %2B. Fine.
>
> This param comes in via:
>
> $c->stash-> =
$c->req->param('username');
>
> A warn on $c->req->param('username');
>
> shows (as does the debug console via _server.pl and via
Apache):
>
>      first.last megmail.com
>
> as a + sign is a shortcut for space in a URL. The above
is a valid e-mail
> address which I need to cater for.
>
> Any ideas on how to get the first.last+megmail.com
into Catalyst without
> the + getting turned into a space?
>
> If it's not possible I can do a redesign of this part
of the site.
>
> Thanks,
>
> Gavin.

If I understand you correctly, this might be useful:

http://
search.cpan.org/dist/URI/URI/Escape.pm

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

Re: + in GET param
country flaguser name
United Kingdom
2007-09-11 09:45:28
<quote who="Will Hawes">
> On 11/09/2007, Gavin Henry <ghenryperl.me.uk> wrote:
>> Dear list,
>>
>> I have created a url via uri_for that produces
(hashref passed in):
>>
>>      http://myserver.com/blah/?username=first.last%2Bme
%40gmail.com
>>
>> so the + is escaped into %2B. Fine.
>>
>> This param comes in via:
>>
>> $c->stash-> =
$c->req->param('username');
>>
>> A warn on $c->req->param('username');
>>
>> shows (as does the debug console via _server.pl and
via Apache):
>>
>>      first.last megmail.com
>>
>> as a + sign is a shortcut for space in a URL. The
above is a valid
>> e-mail
>> address which I need to cater for.
>>
>> Any ideas on how to get the first.last+megmail.com
into Catalyst
>> without
>> the + getting turned into a space?
>>
>> If it's not possible I can do a redesign of this
part of the site.
>>
>> Thanks,
>>
>> Gavin.
>
> If I understand you correctly, this might be useful:
>
> http://
search.cpan.org/dist/URI/URI/Escape.pm
>

That's what uri_for is already doing (I forgot to mention
I'd checked
already).

uri_for:

    http://myserver.com/blah/?username=first.last%2Bme
%40gmail.com

URI::Escape:

perl -MURI::Escape -e "print
uri_escape('first.last+megmail.com')";

    first.last%2Bme%40gmail.com

Same either way.

Thanks though.

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )