Problem with utf-8 filenames in ZIP

0 votes
asked Apr 17, 2013 by Alexander Shagin (200 points)
edited Apr 17, 2013

I got a problem when try to zip folders with file names with national symbols (win-1251 encoding in my case). Archive contains unreadable file names. Seems like component using a wrong file names encoding. How can I manage this issue?

Thank you.

using (var zip = new Rebex.IO.Compression.ZipArchive(archiveFileName, ArchiveOpenMode.CreateNew))
{
  zip.Add(Path.Combine(srcPath, "*"), @"\", TraversalMode.Recursive,
                    TransferMethod.Copy,
                    ActionOnExistingFiles.OverwriteAll);
}
Applies to: Rebex ZIP

2 Answers

0 votes
answered Apr 17, 2013 by Alexander Shagin (200 points)
edited Apr 17, 2013
 
Best answer

Seems like it's a Windows Explorer bug. Unzipped file has a correct file names.

Thank you and sorry for inconvenience.

alt text

commented Apr 17, 2013 by Lukas Matyska (60,650 points)
edited Apr 17, 2013

Yes, Explorer's built-in zip utility cannot handle UTF-8 file names.

+1 vote
answered Apr 17, 2013 by Lukas Matyska (60,650 points)
edited Apr 17, 2013

Can you please describe how the problem manifests?

I have tried your code to compress three files with Chinese, Czech and Russian characters in names and everything works fine (please see the image below).

compressed *.log files with UTF-8 names

I have Win7, NTFS (image shows how TotalCommander displays created zip file, also ZipArchive shows correct names).

...