0

I have this parameter [email protected] in my url. I want to encode it using javascript, I dont want . in my url.

3
  • Take a look at this question: stackoverflow.com/questions/332872/… Commented Sep 29, 2011 at 10:00
  • 1
    Can I ask why don't you want . in your URL? Commented Sep 29, 2011 at 10:02
  • . isn't a reserved character in URLs, so it doesn't make sense to URL Encode it. Commented Sep 29, 2011 at 10:06

1 Answer 1

1

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 / "-" / "." / "_" / "~"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.