使用 DotNetZip 库解压缩带有非 ASCII 字符的文件 [英] Using DotNetZip Library unzip file with non ASCII characters

查看:24
本文介绍了使用 DotNetZip 库解压缩带有非 ASCII 字符的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 DotNetZip 库解压缩文件.

I'm trying to unzip a file, using DotNetZip Library.

该文件包含带有丹麦字符 (æøåÆØÅ) 的文件夹和文件.

The file contains folders and files with danish characters (æøåÆØÅ).

TotalCommander、7Zip、Windows 自带的 zip 都可以正确解压缩文件,但 DotNetZip 库会破坏丹麦字符.

TotalCommander, 7Zip, Windows own zip all extract the files correctly, but DotNetZip Library mangles the danish characters.

例如:File_æøåÆØÅ.txt 变为 File_æ¢åÆ¥Å.txt

插入 它包含一个 ¢.插入 Ø 它包含一个 ¥.

insted of it contains a ¢. insted of a Ø it contains a ¥.

代码:

using (var zipFile = ZipFile.Read(@"File_æøåÆØÅ.zip"))
{
     zipFile.ExtractAll(@"File_æøåÆØÅ",
                        ExtractExistingFileAction.OverwriteSilently);
}

我使用的是默认编码(da-DK"文化),我尝试过其他编码,如 UTF8 等.

I'm using the default encoding("da-DK" culture), I have tried other encodings like UTF8 etc.

如何解压缩包含带有丹麦字符的文件名的文件?

How can I unzip a file containing filenames with Danish characters?

推荐答案

这听起来就像是DotNetZip"中的一个错误 - 您是否尝试过 SharpZipLibZipPackage(在 BCL 中)?编码通常与文件内容有关,而不是名称;所以这不应该是一个因素.

This sounds simply like a bug in "DotNetZip" - have you tried SharpZipLib or ZipPackage (in the BCL)? Encoding typically relates to the file contents, not the name; so this shouldn't be a factor.

您应该将此报告(举例)给作者.

You should report this (with an example) to the author.

这篇关于使用 DotNetZip 库解压缩带有非 ASCII 字符的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆