android php中文乱码的解决办法:1、填写对应的格式,代码如“httpresponse.getentity()),http.utf_8”;2、使用流的形式,代码如“ttpresponse.getentity().get...”。
本文操作环境:windows7系统、php7.1版,dell g3电脑
前后端交互,android+php解决乱码问题
第一种:填写对应的格式
result= entityutils.tostring(httpresponse.getentity()),http.utf_8);result=new string( entityutils.tostring(httpresponse.getentity()).getbytes("iso_8859_1"),http.utf_8);
第二种:使用流的形式
//通过流获取具体的内容in = httpresponse.getentity().getcontent();//创建缓冲区bufferedreader br = new bufferedreader(new inputstreamreader(in));sb = new stringbuffer();string line = null;while((line = br.readline())!= null){ sb.append(line);}result=sb.tostring();
【推荐学习:《php视频教程》】
以上就是如何解决android php 中文乱码问题的详细内容。