开发者

Is % percentage a valid url character

I am trying to put a url, something like the following urn:test.project:123, as part of the url.

Does it make sense to encode urn:test.project:123 into urn%3atest.project%3a123 and decode it back to urn:test.project:123 at the receiver end?

http://{domain}/abc/urn%3开发者_高级运维atest.project%3a123/Manifest


Yes, it's a valid character. It's the escape character for URLs in a similar way to how the ampersand & is the escape character for xml/html, and the backslash \ is the escape character for string literals in c-like languages. It's the (very important) character that allows you to specify (through an escape sequence) all the other characters that wouldn't be valid in a URL.

(And yes, it makes sense to encode such a string so it's a legal URL, and as @PaulPRO mentions, most frameworks will automatically decode it for you on the server-side.)


Yes, the %3a means that 3a is the HEX encoded value for ':' If you put it in the url as %3a your server will most likely automatically decode it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜