最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - URIencode and colon - Stack Overflow

programmeradmin1浏览0评论

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.

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.

Share Improve this question asked Feb 14, 2013 at 10:25 Jaya MayuJaya Mayu 17.2k34 gold badges115 silver badges149 bronze badges 1
  • 2 Take a look @ What is the difference between decodeURIComponent and decodeURI? – Alex K. Commented Feb 14, 2013 at 10:27
Add a comment  | 

1 Answer 1

Reset to default 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()

发布评论

评论列表(0)

  1. 暂无评论