Android读取服务端TXT(JSON格式数据)返回汉字乱码的问题

时间:2021-09-11 19:46:13
JSONObject obj = new JSONObject(verjson);
ApkVersionInfo info = new ApkVersionInfo();
info.apk_name = obj.getString("apk_name");
info.ver_name = obj.getString("ver_name");
info.ver_code = Integer.parseInt(obj.getString("ver_code"));
info.updateDesc=URLDecoder.decode(obj.getString("updateDesc"), "UTF-8");
return info;


只要加上这么一句话即可  info.updateDesc=URLDecoder.decode(obj.getString("updateDesc"), "UTF-8");

但是要保证编码一致,TXT也得是UTF-8.  ok