URL编解码示例

  public static void main(String[] args) {
  String value = "";
  String encodedValue = "";
  try {
   value = URLEncoder.encode("中文", "UTF-8");
   
   encodedValue = URLDecoder.decode(value, "UTF-8");
  } catch (UnsupportedEncodingException e) {
   e.printStackTrace();
  }
  System.out.println(value);
  System.out.println(encodedValue);
 }

你可能感兴趣的:(URL编解码示例)