在C#中解压缩时文件名中的unicode

时间:2013-11-14 13:16:42

标签: c# .net unicode unzip

我有这个解压缩功能,它使用的是.NET库(压缩),但问题是我在文件名中有一些unicode问题,例如“μ”正在转换为“æ”

有没有使用其他解压缩库的问题的解决方案,因为我仅限于一些许可证,发现这个套件我最好

 using System.IO.Compression;

 private void Unzip()
    {
        try
        {
            string appPath = Path.GetDirectoryName(Application.ExecutablePath);

            // unzip update
            using (ZipArchive archive = System.IO.Compression.ZipFile.OpenRead(ZipFile))
            {

                foreach (ZipArchiveEntry entry in archive.Entries)
                {
                    string fullPath = Path.Combine(appPath, entry.FullName);
                    if (String.IsNullOrEmpty(entry.Name))
                    {
                        Directory.CreateDirectory(fullPath);
                    }
                    else
                    {
                        if (!entry.Name.Equals("Updater.exe"))
                        {
                            entry.ExtractToFile(fullPath,true);

                        }
                    }
                }

                //  UpdateProgress(((float)s.Position / (float)fileStream.Length) * 100F);
                //System.Threading.Thread.Sleep(extraWaitMilliseconds); //don't go too fast

            }
            UnzipFinished();  //*********^

        }            
        catch (Exception ex)
        {
        UnzipFailed(ex);
        }
    }

1 个答案:

答案 0 :(得分:0)

我读了你对许可证的限制,但我想,你会发现这篇关于codeproject的文章很有用。

它解释了如何使用带有网络包装的Windows内部ZIP,并且此链接中的讨论主题帮助我使用文件/目录名称中的特殊字符。

Link "C# Use Zip Archives without External Libraries"使用标题作为谷歌搜索项目为我带来了最佳位置的文章。基本上它是关于MS.Internal.IO.Zip。

的包装器