This is a migrated thread and some comments may be shown as answers.

Invalid Japanese/Chinese filename retrieved from zip file

2 Answers 67 Views
ZipLibrary
This is a migrated thread and some comments may be shown as answers.
Yoshiaki
Top achievements
Rank 1
Yoshiaki asked on 23 Jun 2017, 06:07 PM

Hi I'm trying to read a zip file which contains multiple files. Few of the files inside is named in Japanese (and Chinese).

My file: こんにちわ.csv becomes vhtjd.csv instead. I hope you can guide me.

Here is my code:

 using (ZipArchive zip = new ZipArchive(stream, ZipArchiveMode.Read, true, System.Text.Encoding.UTF8))
 {
                        foreach (ZipArchiveEntry e in zip.Entries)
                        {
                            string file= e.Name.ToString(); 

                          }

    }

2 Answers, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 28 Jun 2017, 02:13 PM
Hi Yoshiaki,

I was not able to reproduce this behavior when zipping a file with the same name as you have used. However when I create an archive with ASCII encoding I get a result similar to yours and the name of the file is not recognized. I think that the issue is related with the archive you use. If you created the archive, simply create it with UTF8 encoding. If this does not help, please send us the archive so we could debug it locally.

Regards,
Peshito
Progress Telerik

0
Yoshiaki
Top achievements
Rank 1
answered on 13 Jul 2017, 06:21 AM

Hi Peshito,

Thank you for your support. I found out that WinRar (<5.5) version is causing the issue. I upgraded to the latest, re zip the files and I was able to read the non-English characters.

Best Regards,

Glenn

Tags
ZipLibrary
Asked by
Yoshiaki
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Yoshiaki
Top achievements
Rank 1
Share this question
or