I have this parameter [email protected] in my url. I want to encode it using javascript, I dont want . in my url.
1 Answer
Even if you encode . in JavaScript, the browser is allowed to unencode it before sending it to a server.
RFC 3986 section 6.2.2.2. Percent-Encoding Normalization says
The percent-encoding mechanism (Section 2.1) is a frequent source of variance among otherwise identical URIs. In addition to the case normalization issue noted above, some URI producers percent-encode octets that do not require percent-encoding, resulting in URIs that are equivalent to their non-encoded counterparts. These URIs should be normalized by decoding any percent-encoded octet that corresponds to an unreserved character, as described in Section 2.3.
'.' is an unreserved character in URLs.
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
.in your URL?.isn't a reserved character in URLs, so it doesn't make sense to URL Encode it.