url中特殊编码还原成真实的字符

URL编码表

backspace8%A41%a61%§%A7Õ%D5 
tab9%B42%b62%«%ABÖ%D6 
linefeed%0AC43%c63%¬%ACØ%D8 
creturn%0DD44%d64%¯%ADÙ%D9 
space20%E45%e65%º%B0Ú%DA 
!21%F46%f66%±%B1Û%DB 
"22%G47%g67%ª%B2Ü%DC 
#23%H48%h68%,%B4Ý%DD 
$24%I49%i69%µ%B5Þ%DE 
%25%J%4Aj%6A»%BBß%DF 
&26%K%4Bk%6B¼%BCà%E0 
'27%L%4Cl%6C½%BDá%E1 
(28%M%4Dm%6D¿%BFâ%E2 
)29%N%4En%6EÀ%C0ã%E3 
*%2AO%4Fo%6FÁ%C1ä%E4 
+%2BP50%p70%Â%C2å%E5 
,%2CQ51%q71%Ã%C3æ%E6 
-%2DR52%r72%Ä%C4ç%E7 
.%2ES53%s73%Å%C5è%E8 
/%2FT54%t74%Æ%C6é%E9 
030%U55%u75%Ç%C7ê%EA 
131%V56%v76%È%C8ë%EB 
232%W57%w77%É%C9ì%EC 
333%X58%x78%Ê%CAí%ED 
434%Y59%y79%Ë%CBî%EE 
535%Z%5Az%7AÌ%CCï%EF 
636%      ð%F0 
737%?%3F{%7BÍ%CDñ%F1 
838%@40%|%7CÎ%CEò%F2 
939%[%5B}%7DÏ%CFó%F3 
:%3A\%5C~%7EÐ%D0ô%F4 
;%3B]%5D¢%A2Ñ%D1õ%F5 
%3C^%5E£%A3Ò%D2ö%F6 
=%3D_%5F¥%A5Ó%D3÷%F7 
%3E`60%|%A6Ô%D4ø%F8 
        ù%F9 


程序对url解码:

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

String deurl = URLDecoder.decode(url,"UTF-8");

必须加编码UTF-8或者正文的编码GB2312

否则就会提示不推荐使用

The method decode(String) from the type URLDecoder is deprecated

,decoder中间会被画一条横线。

评论 (0)

发表评论