1.先在设置服务器编码:找到Tomcat安装目录下的server.xml文件(Tomcat 6.0\conf\server.xml)。设置编码为UTF-8
<Connectorport="8080" URIEncoding="UTF-8" redirectPort="8443" connectionTimeout="20000" protocol="HTTP/1.1"/>
2. android 中代码为:
String UrlStr = "http://192.168.1.110:8080/mp3/"+ URLEncoder.encode(测试.mp3,"UTF-8");
<Connectorport="8080" URIEncoding="UTF-8" redirectPort="8443" connectionTimeout="20000" protocol="HTTP/1.1"/>
2. android 中代码为:
String UrlStr = "http://192.168.1.110:8080/mp3/"+ URLEncoder.encode(测试.mp3,"UTF-8");