URL Encode and Decode Special character in Java
问题 In Java, I need to use HTTP Post to send request to server, but if in the parameter of the URL contains some special character it throws below Exception java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "&'" The code to send data DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(URL); String sessionId = RequestUtil.getRequest().getSession().getId(); String data = arg.getData().toString();