Este artigo apresenta principalmente a solução para o problema de apenas Urlencode no ASP e sem urldecode?
Existe um servidor de função do sistema muito útil Também foi fornecido, mas depois de usá -lo, descobri que o programa relatou um erro. O que fazer, faça você mesmo.
O princípio do URLENCODE é realmente muito simples.
- Função de decodificação da URL da FunctUrlDecode (ENSTR)
- DimDest
- dimc, i, v
- destro =
- fori = 1Tolen (Enstr)
- C = MID (ENSTR, I, 1)
- ifc =%então
- V = EVALL (& H+MID (ENSTR, I+1,2))
- ifv <128then
- Dest = destro & Chr (V)
- i = i+2
- outro
- ifisValidhex (MID (Enstr, i, 3)) então
- ifisValidhex (MID (ENSTR, I+3,3)) então
- V = EVALL (& H+MID (ENSTR, I+1,2)+MID (ENSTR, I+4,2))
- Dest = destro & Chr (V)
- i = i+5
- outro
- V = EVALL (& H+MID (ENSTR, I+1,2)+CSTR (HEX (ASC (MID (ENSTR, I+3,1)))))))))))))))))))))))))
- Dest = destro & Chr (V)
- i = i+3
- endif
- outro
- desto = destro & c
- endif
- endif
- outro
- ifc =+então
- desto = destro &
- outro
- desto = destro & c
- endif
- endif
- próximo
- Urldecode = destro
- Função final
- FunctionisValidhex (STR)
- isvalidhex = true
- str = ucase (str)
- iflen (str) <> 3ThenisValidhex = false: exitfunção
- ifleft (str, 1) <>%thenisvalidhex = false: exitfunção
- C = MID (STR, 2,1)
- ifnot (((c> = 0) e (c <= 9)) ou ((c> = a) e (c <= z))) thenisvalidhex = false: exitfunção
- C = MID (STR, 3,1)
- ifnot (((c> = 0) e (c <= 9)) ou ((c> = a) e (c <= z))) thenisvalidhex = false: exitfunção
- Função final
Não há problema em usar o formato ASP no formato GB312 após o teste.