I am trying to zip a file using C# (.net 4.6). Here is my code:
string targetLoc = @"C:\path\to\target\zip";
string sourceFile = @"C:\path\to\source\file\ファイル名.csv";
ZipArchive zip = ZipFile.Open(Path.Combine(targetLoc, "ZipFile.zip"), ZipArchiveMode.Create, Encoding.UTF8);
using (zip)
{
string fileName = Path.GetFileName(sourceFile);
zip.CreateEntryFromFile(sourceFile, fileName);
}
The problem is, the file name contained in the resulted zip file became this: 繝輔ぃ繧、繝ォ蜷・csv
. I tried changing the encoding of the zip
(in the ZipArchive zip = ZipFile.Open(Path.Combine(targetLoc, "ZipFile.zip"), ZipArchiveMode.Update, Encoding.UTF8);
), but I got ArgumentException
saying that the encoding is not supported.
Is there any workaround for this? As much as possible I do not want to use third party library.
note1: the zip file did not previously exist.
note2: I am using win7 Pro, Japanese version (not possible to change language)
Thank you in advance!