查询变量中可以使用哪些有效的 URL 字符?
URL 查询变量中可以使用哪些有效字符?
我这样问是因为我想通过使用最大的字符集创建最小字符串长度的 GUID,只要它们可以作为 URL 查询变量传递(www.StackOverflow.com?query=guiddaf09834fasnv)
编辑
如果要编码将 UUID/GUID 或以字节数组表示的任何其他信息转换为 url 友好的字符串,您可以在 Apache Commons 代码库:
Base64.encodeBase64URLSafeString(byte[])
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.encodeBase64URLSafeString(byte[])
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如有疑问,请访问 RFC。
注意:查询变量的处理方式与 URL 其余部分的处理方式不同。
来自“2.2. URL字符编码问题”部分
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"