public static void main(String[] args) { try { String mytext = java.net.URLEncoder.encode("上海南站", "utf-8"); System.err.println("mytext: " + mytext); String mytxt = URLEncoder.encode("上海南站"); System.err.println("mytxt: " + mytext); //%E4%B8%8A%E6%B5%B7%E5%8D%97%E7%AB%99 //输出:mytext: %E4%B8%8A%E6%B5%B7%E5%8D%97%E7%AB%99 } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
否则传输到APP服务端接收到的是中文乱码,导致查询数据有误~!
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/15256.html