18 char * urldecode(char *encd,char *decd)
19 {
20 int j,i;
21 char *cd = encd;
22 char p[2];
23 int num;
24 j =0;
25
26 for(i = 0;i < strlen(cd);i++)
27 {
28 memset(p,'\0',2);
29 if(cd[i] != '%')
30 {
31 decd[j++] = cd [i];
32 continue;
33 }
34 p[0] = cd[++i];
35 p[1] = cd[++i];
36
37 p[0] =p[0] -48 -((p[0] >= 'A') ? 7:0) - ((p[0] >= 'a') ? 32:0);
38 p[1] =p[1] -48 -((p[1] >= 'A') ? 7:0) - ((p[1] >= 'a') ? 32:0);
39 decd[j++] = (p[0] * 16 + p[1]);
40 }
41 decd[j] = '\0';
42
43 return decd;
44 }
url编码函数
最新推荐文章于 2024-04-17 17:27:54 发布