rebex ZIP archive contains Extended ASCII Codes

0 votes
asked Nov 8, 2011 by Daniele (140 points)
edited Mar 12, 2012

When opening ZIP archive containing Extended ASCII Codes the filename result string is wrong.

For example: civiltà.png

For Each item As ZipItem In items
     If item.IsFile Then
          Console.WriteLine(item.Name)
     End If
Next

item.Name is civilt....png

How can I resolve this issue? Thank you advance.

Daniele

Applies to: Rebex ZIP
commented Nov 8, 2011 by Daniele (140 points)
edited Nov 8, 2011

In our testing if you create ZIP with REBEX all works fine. If you create a zip file using windows zip utility and after extract with rebex it doesn't work.

1 Answer

0 votes
answered Nov 8, 2011 by Lukas Matyska (60,690 points)
edited Mar 12, 2012

It is a bug caused by using an invalid Encoding. It will be fixed in next version. In the meantime please use the following method as a workaround for incorrectly encoded names:

public static string FixEncoding(string text)
{
    Encoding cp437 = Encoding.GetEncoding(437);
    return cp437.GetString(Encoding.Default.GetBytes(text));
}

Thank you for pointing to this and we are sorry for any inconveniences.

UPDATE

The fix is part of Release 2012 R1. Default charset changed to IBM437 (used to be Encoding.Default).

...