Search code examples
httpurlurl-encoding

Does the @ (at) symbol need to be encoded in a URL path?


Is it okay to use an unencoded @/at symbol in a URL path like this?

https://example.com/User/[email protected]

Precent-encoded, it would be https://example.com/User/test%40example.com, which is not as readable by humans.

Either appears to work in the major browsers - wondering if there are cases where it would cause problems.


Solution

  • Have a look at the "pchar" ABNF rule in RFC 3986 (http://greenbytes.de/tech/webdav/rfc3986.html#path):

    pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
    

    So yes, "@" is allowed and does not need to be escaped.