Open azhu003 opened 4 years ago
兄弟你贴出来的的两段代码是一样的啊。。。
抱歉,源代码是这段
final int BUFFER_SIZE = compressed.length;
GZIPInputStream gis = null;
ByteArrayInputStream is = null;
try {
is = new ByteArrayInputStream(compressed);
gis = new GZIPInputStream(is, BUFFER_SIZE);
StringBuilder string = new StringBuilder();
byte[] data = new byte[BUFFER_SIZE];
int bytesRead;
while ((bytesRead = gis.read(data)) != -1) {
string.append(new String(data, 0, bytesRead, charsetName));
}
return string.toString();
} catch (IOException e) {
e.printStackTrace();
} finally {
closeQuietly(gis);
closeQuietly(is);
}
return null;
Environment
Bug Description:
ZipHelper#decompressForGzip while ((bytesRead = gis.read(data)) != -1) { string.append(new String(data, 0, bytesRead, charsetName)); } 拼接中文时会乱码
Related Code:
替换为以下代码可修复
Others: