url = URLEncoder.encode(urlStr,"utf-8").replaceAll("\\+", "%20");
//encode会将空格替换为+号,所有要讲+号替换为空格的转义%20
url = url.replaceAll("%3A", ":").replaceAll("%2F", "/");
//encode会把url里的/和:这2个符号变成%2F和%3A 这里替换回来
android URL中文和空格会报错解决方案,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/songwen/p/3709642.html