URIencode and colon
Asked Answered
E

1

9

colon is a character which can be encoded to '%3A' as per many sites and when I try to encode using URIencode it is not working

for example if I try to encode like URIencode(':'); then nothing happens. colon is returned. Why is this?? can someone help me out here.

Thanks in advance.

Eyewitness answered 14/2, 2013 at 10:25 Comment(1)
Take a look @ What is the difference between decodeURIComponent and decodeURI?Smitten
S
20

The encodeURI() encodes special characters, except:

, / ? : @ & = + $ #

You should use this instead encodeURIComponent(':');

This function encodes special characters. In addition, it encodes the characters skipped by encodeURI()

Septal answered 14/2, 2013 at 10:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.