public class URLDecoder extends Object
application/x-www-form-urlencoded
MIME格式的字符串的静态方法。
转换过程是由urlencoder班采用反向。这是假设在编码的字符串的所有字符都是下列之一:“a
”通过“z
”、“A
”通过“Z
”、“0
”通过“9
”、和“-
”、“_
”、“.
”、和“*
”。字符“%
”是允许的但被解释为一种特殊的序列开始逃跑。
下面的规则应用在转换中:
a
”通过“z
”、“A
”通过“Z
”和“0
”通过“9
”保持不变。.
”、“-
”、“*
”、和“_
”保持不变。+
”转换为空格字符“ ”。有两种可能的方法,该解码器可以处理非法字符串。它可以把非法字符单独或可能引发IllegalArgumentException
。该方法的解码器需要的执行。
Constructor and Description |
---|
URLDecoder() |
@Deprecated public static String decode(String s)
x-www-form-urlencoded
字符串。平台默认的编码是用来确定哪些字符代表任何连续序列的形式“XY”。
s
-
String
解码
String
public static String decode(String s, String enc) throws UnsupportedEncodingException
application/x-www-form-urlencoded
字符串。支持的编码是用来确定哪些字符代表任何连续序列的形式“XY”。
注:万维网联盟推荐的国家应该使用UTF-8。不这样做可能会引入不兼容。
s
-
String
解码
enc
-支持的
character encoding名称。
String
UnsupportedEncodingException
如果字符编码需要咨询,但指定的字符编码不支持
URLEncoder.encode(java.lang.String, java.lang.String)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.