将字转化为码是编码,将码转为字是解码

URLEncoder(字符串编码)

//HTML表单编码的实用程序类。,以utf-8的格式编成码  罗德-10110101010
URLEncoder.encode("罗德", "UTF-8")'

//参数: s–要翻译的字符串。 enc–支持的字符编码的名称。 返回: 翻译后的字符串。
public static String encode(String s, String enc)
//HTML表单解码的实用程序类。 1010111010-罗德
URLDecoder.decpde("10101101011","utf-8")

//参数: s–要解码的字符串 enc–支持的字符编码的名称。 返回: 新解码的字符串
public static String decode(String s, String enc)

更多推荐