ZipEntry压缩时中文文件名乱码解决办法

代码如下:


		ZipOutputStream zipOut = new ZipOutputStream(byteOutPutStream);
		// 使用指定名称创建新的 ZIP 条目 
		ZipEntry zipEntry = new ZipEntry(value.get("fileName"));
				

代码本身是没有问题的,在使用zipEntry时出现文件名是中文时的乱码不怪代码,只需将ZipEntry换成阿帕奇的就可以了:


import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipOutputStream;
发布了109 篇原创文章 · 获赞 34 · 访问量 12万+

猜你喜欢

转载自blog.csdn.net/shuaicenglou3032/article/details/102958455