Rodrigo
Rodrigo

Reputation: 12693

URL: Username with @

To send username and password with a URL, we use this scheme:

http://username:[email protected]_site.com

But my username is [email protected].
The problem is the @.

How can I solve it?

Upvotes: 166

Views: 123532

Answers (3)

Matas Vaitkevicius
Matas Vaitkevicius

Reputation: 61479

Just do:

 http://my_email%40gmail.com:[email protected]_site.com

I am quite surprised that problem was with username @ and not the password -usually this is where I get reserved characters in url authority or path parts.

To solve general case of special characters: Just open chrome console with F12 then paste encodeURIComponent(str) where str is your password (or username) and then use the encoded result to form url with password.

Or just run the below snippet and dump it here.

Put Url here
<br/>
<input type='text' id='urlEncodeField' style="width:250px" value='[email protected]' />
<input type='button' value='Click' onClick="console.log(encodeURIComponent(document.getElementById('urlEncodeField').value))" />

Hope this saves you some time.

Upvotes: 29

inevio
inevio

Reputation: 887

Use %40 in your username instead of the @ symbol for the url encoding. It should pass it properly then.

Upvotes: 21

Joe
Joe

Reputation: 6416

You need to URL encode the @ as %40.

Upvotes: 245

Related Questions