今天在用Android的
URL url = new URL("http://www.android100.org/extend/search.php?sebox=学习");
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
传递到服务端的中文字符是乱码,最后是将要发送的字符经过编号就可以了,代码修改如下:
URL url = new URL("http://wwwandroid100.org/extend/search.php?sebox="+java.net.URLEncoder.encode("学习"));
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();