Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@ converted to %40 in GET

I'm using http://jquery.malsup.com/form/ and I'm posting an e-mail address to a url using GET.

It looks like the @ in the email address is being converted to %40.

Will this be an issue for the site capturing the data?

like image 503
Ben Paton Avatar asked Mar 09 '12 09:03

Ben Paton


1 Answers

%40 is the URL-encoded version of @. This conversion only takes place in the URL. The server will still see it as @, and if necessary you can even use JavaScript to decode it:

decodeURIComponent('%40'); // '@'
// or, to encode it back:
encodeURIComponent('@'); // '%40'

Here’s an example of a URL that will get parsed as you’d expect on the server-side:

http://mathiasbynens.be/demo/get?x=%40

If you visit the page, you’ll see that it prints @, not %40.

Here’s an example of a URL that will get parsed as you’d expect on the client-side, by using decodeURIComponent:

http://mothereff.in/byte-counter#%40

If you visit the page, you’ll see that the textarea’s contents are set to @, not %40.

like image 97
Mathias Bynens Avatar answered Oct 04 '22 18:10

Mathias Bynens