开发者

What are the valid URL characters that can be used in a query variable?

What are the valid characters that can be used in a URL query variable?

I'm asking because I would like to create GUIDs of minimal string length by using the largest character set so long as they can be passed as a URL query variable (www.StackOverflow.com?query=guiddaf09834fasnv)

Edit

If you want to encode a UUID/GUID or any other information represented in a byte array into a url-friendly string, you can use this method in the Apache Commons Code library:

Base64.encodeBas开发者_开发知识库e64URLSafeString(byte[])


When in doubt, just go to the RFC.

Note: A query variable is not dealt with any differently then the rest of the URL.

From the section "2.2. URL Character Encoding Issues"

... only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜