URIencode和冒号 [英] URIencode and colon

查看:486
本文介绍了URIencode和冒号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

冒号是一个可以在许多站点上编码为'%3A'的字符,当我尝试使用URIencode进行编码时,它不起作用

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

例如,如果我尝试像URIencode(':');那样编码,则什么也不会发生.冒号返回.为什么是这样??有人可以帮我吗?

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

先谢谢了.

推荐答案

encodeURI()编码特殊字符,除了:

The encodeURI() encodes special characters, except:

, / ? : @ & = + $ #

您应该改用encodeURIComponent(':');

此功能编码特殊字符.此外,它还对encodeURI()

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

这篇关于URIencode和冒号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆