【发布时间】:2013-11-28 14:58:19
【问题描述】:
我有解压功能,我使用System.Text.Encoding 来确保解压后的文件保持相同的名称,因为我解压的文件通常包含德语字母。
我尝试了不同的东西,比如 Encoding.Default 或 Encoding.UTF8 但没有任何效果
äÄéöÖüß.txt 被转换为 „Ž‚”™á.txt 或者在默认情况下是黑框:/
有什么建议吗?
using (ZipArchive archive = System.IO.Compression.ZipFile.Open(ZipFile, ZipArchiveMode.Read, System.Text.Encoding.Default))
{
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);
}
}
}
}
【问题讨论】:
-
你也可以试试
UTF32 -
运行时报错“不支持指定的条目名称”
-
您确定文件名存储正确吗?使用其他解压缩程序会显示哪些名称?
-
我用的是 7-zip,还有德语字母... :/