url encode的概念和实现?

发布于 2022-09-03 23:26:23 字数 254 浏览 10 评论 0

  1. 为什么要进行url encode(或者说url encode的意义)?

  2. 如何实现url encode?

更新

答案最好:

  • 通俗易懂,题主是看不了rfc文档才来提问的。

  • 详细一些,为了安全为了传输数据方便,这种回答过于简单,最好能详细铺开表达一下。

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我是男神闪亮亮 2022-09-10 23:26:28

建议楼主去下一本《Http权威指南》来看看。
就看 2.4 节:各种令人头痛的字符
看图吧~
编码

保留字符


Reserved and restricted characters

Character              Reservation/Restriction
 
%                      Reserved as escape token for encoded characters
 
/                      Reserved for delimiting splitting up path segments in the path component 
 
.                      Reserved in the path component
 
..                     Reserved in the path component
 
#                      Reserved as the fragment delimiter
 
?                      Reserved as the query-string delimiter
 
;                      Reserved as the params delimiter
 
:                      Reserved to delimit the scheme, user/password, and host/port components 
 
$ , +                  Reserved
 
@ & =                  Reserved because they have special meaning in the context of some schemes 
 
{ } | \ ^ ~ [ ] `     Restricted because of unsafe handling by various transport agents, such as gateways 
 
< > "                  Unsafe; should be encoded because these characters often have meaning outside the scope of the URL, such as delimiting the URL itself in a document (e.g., "http://www.joes-hardware.com") 
 
0x00-0x1F, 0x7F        Restricted; characters within these hex ranges fall within the nonprintable section of the US-ASCII character set 
 
> 0x7F                 Restricted; characters whose hex values fall within this range do not fall within the 7-bit range of the US-ASCII character set 
番薯 2022-09-10 23:26:28

encode通常是传输或存储的需要。

具体概念和设计可以查看 rfc文档

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文