2013-02-14 87 views
3

結腸是可以,如果我嘗試編碼像URIencode(':');則沒有被編碼爲每許多網站,當我嘗試使用URIencode編碼它不工作URIencode和結腸

例如「%3A」字符發生。冒號被返回。爲什麼是這樣??有人能幫助我嗎?

在此先感謝。

+1

看看@ [[decodeURIComponent和decodeURI之間有什麼區別?](http://stackoverflow.com/questions/747641/what-is-the-difference-between -decodeuricomponent和 - decodeuri) – 2013-02-14 10:27:57

回答

10

encodeURI()特殊字符編碼,除非:

,/? : @ & = + $ #

您應該使用這個代替encodeURIComponent(':');

該功能將特殊字符編碼。此外,它編碼的字符跳過encodeURI()