URL编码是将URL中的不可打印字符或特殊字符转换为Web浏览器和服务器无歧义和普遍接受的表示形式的做法。这些字符包括 -
ASCII control characters − Unprintable characters typically used for output control. Character ranges 00-1F hex (0-31 decimal) and 7F (127 decimal). A complete encoding table is given below.
Non-ASCII control characters − These are characters beyond the ASCII character set of 128 characters. This range is part of the ISO-Latin character set and ncludes the entire "top half" of the ISO-Latin set 80-FF hex (128-255 decimal). A complete encoding table is given below.
Reserved characters − These are special characters such as the dollar sign, ampersand, plus, common, forward slash, colon, semi-colon, equals sign, question mark, and "at" symbol. All of these can have different meanings inside a URL so need to be encoded. A complete encoding table is given below.
Unsafe characters − These are space, quotation marks, less than symbol, greater than symbol, pound character, percent character, Left Curly Brace, Right Curly Brace , Pipe, Backslash, Caret, Tilde, Left Square Bracket , Right Square Bracket, Grave Accent. These character present the possibility of being misunderstood within URLs for various reasons. These characters should also always be encoded. A complete encoding table is given below.
The encoding notation replaces the desired character with three characters: a percent sign and two hexadecimal digits whose correspond to the position of the character in the ASCII character set.
Example
最常见的特殊字符之一就是空间。您不能直接在URL中键入空格。字符集中的空格位置为20十六进制。因此,当您将请求传递到服务器时,可以使用%20放置空间。
http://www.example.com/new%20pricing.html
该URL实际上从www.example.com检索名为new pricing.html的文档
ASCII控制字符编码
这包括字符范围00-1F十六进制(十进制0-31)和7F(十进制十进制)的编码
小数十六进制值字符网址编码
000%00
101%01
202%02
303%03
404%04
505%05
606%06
707%07
808退格%08
909标签%09
100a换行%0a
110b%0b
120c%0c
130d回车%0d
140e%0e
150f%0f
1610%10
1711%11
1812%12
1913%13
2014%14
2115%15
2216%16
2317%17
2418%18
2519%19
261a%1a
271b%1b
281c%1c
291d%1d
301e%1e
311f%1f
1277f%7f
非ASCII控制字符编码
这包括ISO-Latin设置80-FF十六进制(128-255十进制)的整个“上半部分”的编码。
小数十六进制值字符网址编码
12880€%80
12981??%81
13082,%82
13183ƒ%83
13284“%84
13385...%85
13486†%86
13587‡%87
13688ˆ%88
13789‰%89
1388aŠ%8a
1398b
1408cŒ%8c
1418d??%8d
1428eŽ%8e
1438f??%8f
14490??%90
14591“%91
14692“%92
14793“%93
14894“%94
14995••%95
15096-%96
15197-%97
15298〜%98
15399™%99
1549aš%9a
1559b>%9b
1569cœ%9c
1579d??%9d
1589ež%9e
1599fŸ%9f
160a0%a0
161a1¡%a1
162a2¢%a2
163a3£%a3
164a4¤%a4
165a5¥%a5
166a6|%a6
167a7§%a7
168a8¨%a8
169a9©%a9
170aaª%aa
171ab«%ab
172ac¬%ac
173广告%广告
174ae®%ae
175af¯%af
176b0°%b0
177b1±%b1
178b2²%b2
179b3³%b3
180b4“%b4
181b5μ%b5
182b6¶%b6
183b7·%b7
184b8¸%b8
185b9¹%b9
186baº%ba
187bb»%bb
188公元前¼%公元前
189bd½%bd
190是¾%是
191bf¿%bf
192c0一个%c0
193c1一个%c1
194c2一个%c2
195c3一个%c3
196c4一个%c4
197c5一个%c5
198c6Æ%v6
199c7C%c7
200c8È%c8
201c9É%c9
202caÊ%ca
203cbË%cb
204cc一世%cc
205光盘一世%光盘
206ce一世%ce
207参考一世%cf
208d0Ð%d0
209d1Ñ%d1
210d2Ò%d2
211d3Ó%d3
212d4Ô%d4
213d5Õ%d5
214d6Ö%d6
215d7×%d7
216d8Ø%d8
217d9Ù%d9
218大Ú%da
219dbÛ%db
220直流Ü%dc
221ddÝ%dd
222deÞ%de
223dfß%df
224e0一个%e0
225e1一个%e1
226e2一个%e2
227e3一个%e3
228e4一个%e4
229e5一个%e5
230e6æ%e6
231e7C%e7
232e8è%e8
233e9é%e9
234eaê%ea
235ebë%eb
236ec一世%ec
237ed一世%ed
238ee一世%ee
239if一世%ef
240f0ð%f0
241f1ñ%f1
242f2ò%f2
243f3ó%f3
244f4ô%f4
245f5õ%f5
246f6ö%f6
247f7÷%f7
248f8ø%f8
249f9ù%f9
250faú%fa
251fbû%fb
252fcü%fc
253fdý%fd
254feþ%fe
255ffÿ%ff
保留字符编码
以下是用于编码保留字符的表。
小数十六进制值Char网址编码
3624$%24
3826&%26
432b+%2b
442c,%2c
472f/%2f
583a:%3a
593b;%3b
613d=%3d
633f?%3f
6440@%40
不安全的字符编码
以下是用于编码不安全字符的表。
小数十六进制值Char网址编码
3220空间%20
3422“%22
603c
623e>%3e
3523#%23
3725%%25
1237b{%7b
1257d}%7d
1247c|%7c
925c%5c
945e^%5e
1267e〜%7e
915b[%5b
935d]%5d
9660`%60