例如:http://www.baidu.com?keyword=中国人
URLEncoder之后:http://www.baidu.com?keyword=%E4%B8%AD%E5%9B%BD%E4%BA%BA
------解决思路----------------------
public static void main(String[] args)
{
String str = "";
Pattern pattern = Pattern.compile("[\u4e00-\u9fa5]+");
Matcher matcher = pattern.matcher(str);
while(matcher.find()){
String mStr = matcher.group();
try{
str = str.replaceFirst(mStr,URLEncoder.encode(mStr,"UTF-8"));
} catch(Exception e){
}
}
System.out.println(str);
}