Invalid Japanese/Chinese filename retrieved from zip file

3 posts, 0 answers
  1. Yoshiaki
    Yoshiaki avatar
    4 posts
    Member since:
    Apr 2014

    Posted 23 Jun Link to this post

    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. Peshito
    Admin
    Peshito avatar
    523 posts

    Posted 28 Jun Link to this post

    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

  3. Yoshiaki
    Yoshiaki avatar
    4 posts
    Member since:
    Apr 2014

    Posted 13 Jul in reply to Peshito Link to this post

    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

Back to Top