This project is read-only.

Chinese character problem when extracting zip file

Dec 11, 2012 at 11:25 AM


I would be extremely grateful if anybody could help me with this. I have a zip file (named that has folders inside it that have chinese names. I use the following code to try and extract the files and folders.

using (ZipFile zip = new ZipFile(chineseZipPath))

    zip.AlternateEncoding = Encoding.GetEncoding(950);
    zip.AlternateEncodingUsage = ZipOption.Always;
    zip.ExtractAll(m_targetActititiesPath, ExtractExistingFileAction.OverwriteSilently);

What happens next is that the files and folders are extracted from the zip file but they do not have the correct names. Instead they have what appear to be character identifiers. e.g. One of the folder names is: #U6d4b#U91cf#U89d2#U5ea6

I have tried all of the standard encoding options. UTF-8, Unicode, UTF-32 ... None of these make any difference.

Does anybody know what could be amiss here? Many thanks in advance.


Dec 9, 2013 at 7:56 AM
try initialize the encoding in the ZipFile construction, you will find the behavior is different with yours. I didn't any differrenct they are, but it resolved my problem.

using (ZipFile zip = new ZipFile(chineseZipPath, Encoding.GetEncoding(950)))

BTW. if the file is not ziped by Ionic.Zip, the name might be changed after you unzip it with Ionic.Zip. In my situation, I use Ionic.Zip both zip and unzip, and there is no problem for me. The following is my simple test code:

using (ZipFile zip = new ZipFile(System.Text.Encoding.GetEncoding(950)))


string tempFolder = @"c:\theme\result";
using (ZipFile zip = ZipFile.Read(@"c:\theme\", new ReadOptions() { Encoding = System.Text.Encoding.GetEncoding(950)}))
foreach (ZipEntry e in zip)
    e.Extract(tempFolder, ExtractExistingFileAction.OverwriteSilently);