代码如下:
/**
* Translates a string into x-www-form-urlencoded
* format. This method uses the platform'sdefault encoding
* as the encoding scheme to obtain thebytes for unsafe characters.
*
* @param s String
to betranslated.
* @deprecated The resulting string mayvary depending on the platform's
* default encoding. Instead, use theencode(String,String)
* method to specify the encoding.
* @return the translated String
.
*/
@Deprecated
public static String encode(String s) {
String str = null;
try {
str = encode(s, dfltEncName);
} catch(UnsupportedEncodingException e) {
// The system should always have theplatform default
}
return str;
}