38

I am trying to setup an HTTP proxy on a Windows machine. Problem is, the password has a special character (@) in it that is causing the set command to fail.

I have tried both escaping the character (\@) and percent-encoding it with the hex value (%40), to no avail.

For example, with the username Foo and password B@r, I have tried the following commands:

set http_proxy=http://foo:B\@[email protected]:80
set http_proxy=http://foo:B%[email protected]:80

Other than changing the password how can I have the proxy use the password?

Indrek
  • 24,204
  • 14
  • 90
  • 93
pyropenguin
  • 381
  • 1
  • 3
  • 4

4 Answers4

49

You have to percent-encode | encode the special characters. E.g. instead of this:

http://foo:B@[email protected]:80

you write this:

http://foo:B%[email protected]:80

So @ gets replaced with %40.

Note: foo = username, b@r = password, http-gateway.domain.org = host proxy to connect

Ravi Parekh
  • 597
  • 4
  • 7
3

For any special characters, in username or password, we can always use UTF-8 encoded strings in its place. For example: ! can be replaced with %21

so the command would be, if password is abc!:

npm config set proxy http://user:abc%[email protected]:8080/

npm config set https-proxy http://user:abc%[email protected]:8080/

2

Use %Ascii code of the special character in hexadecimal notation for any special character. Suppose My password is AB@12#& then the password should be set as

git config --global http.proxy *http://usernamne:**AB%4012%23%26**@myipadress:portnumber*

Refer to ascii table for knowing the hexadecimal ascii code of any number.

Prasanna
  • 4,036
  • 5
  • 34
  • 51
-1

Based upon this answer on SO, can you try using ^ to escape the @ symbol?

Mike Cornell
  • 143
  • 1
  • 5