URL特殊字符转义

URL中一些字符的特殊含义,基本编码规则如下:

1、空格换成加号(+)
2、正斜杠(/)分隔目录和子目录

3、问号(?)分隔URL和查询
4、百分号(%)制定特殊字符
5、#号指定书签
6、&号分隔参数

如果需要在URL中用到,需要将这些特殊字符换成相应的十六进制的值

字符                                   URL编码值

空格                                     %20

"                                         %22

#                                        %23

%                                        %25

&                                         %26

(                                         %28

)                                         %29


+                                          %2B

,                                          %2C

/                                          %2F

:                                          %3A

;                                          %3B

<                                          %3C

=                                          %3D

>                                          %3E

?                                         %3F

@                                         %4o

\                                           %5C


|                                           %7C

posted @ 2011-03-24 22:18  周宏伟  阅读(767)  评论(0编辑  收藏  举报