String param = request.getParameter("userName"); // param:%E5%AD%99%E6%82%9F%E7%A9%BA1
String userName = URLDecoder.decode(param, "UTF-8"); // 孙悟空1
userName=孙悟空1
String url = URLEncoder.encode(userName, "UTF-8"); //%E5%AD%99%E6%82%9F%E7%A9%BA1
这样就很清楚了,urlencode是转码,urldecode是解码