views:

34

answers:

2

Hi,

I am passing the email address as part of the url,

for ex. http://example.com/hello/[email protected]

but, when being passed to the application controller it is changed to " user%40hotmail.com ".

I can't seem to understand this special character escaping; confusion. please help me explain the problem here, and also what can I do to fix it.

I am using python's "webapp" web application framework.

+1  A: 

@ turns into %40 because of percent encoding commonly known as url encoding.

Without knowing exactly how the code is being used, it would be worth while to look at urllib utility functions for decoding. Here is one for example,

Replace %xx escapes by their single-character equivalent.

Anthony Forloney
+1  A: 

It's being URL encoded.

You'll need to decode it.

Jack Marchetti
I think i probably should use, urllib2.ubquote("email%40domain.com")this seems to work
phoenix24
`ubquote` won't work, but `unquote` will :)
Anthony Forloney