SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

How to use CreateZip and IsUnicodeText ?

Last post 09-04-2008 8:41 AM by DomZ. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-01-2008 6:19 PM

    • DomZ
    • Top 500 Contributor
    • Joined on 09-01-2008
    • Posts 6

    How to use CreateZip and IsUnicodeText ?

    Hi,

     I need to create a zip file of a directory which contains some directories and some files use unicode chars.

     CreateZip is a good starting point because it can be recursive, but i don't know how to use this method with the IsUnicodeText property.

    For doing some tests, I have make the following code :

    foreach (EncodingInfo enc in Encoding.GetEncodings())

    {

    FastZip zip = new FastZip();

    zip.UseZip64 = UseZip64.Off;

    ZipConstants.DefaultCodePage = enc.CodePage; zip.CreateZip(@"C:\Temp\" + enc.CodePage + ".zip", pathToZip, true, "");

    }

     This one has generated 140 zip files, but none of them had the correct chars (chinese).

     So I really need a recursive method that use IsUnicodeText for folder and file names.

     Thanks.

  • 09-02-2008 10:22 PM In reply to

    Re: How to use CreateZip and IsUnicodeText ?

    Hi,

     

    FastZip has an EntryFactory property which is by default a ZipEntryFactory.  You can set the IsUnicodeText property for this factory and all should be fine.

     

    hth, -jr-

  • 09-03-2008 8:11 AM In reply to

    • DomZ
    • Top 500 Contributor
    • Joined on 09-01-2008
    • Posts 6

    Re: How to use CreateZip and IsUnicodeText ?

    Hi John,

    It seems that I can't do anything with this EntryFactory, do you how should I use it ?

    For now I have extend the class FastZip and add a property "UseUnicode" but this is a temporary solution, because of the licence we can't do that (we use it in commercial product). Tell me if you want the modified code (about 6 lines :p).

    Regards,

    Dominique

  • 09-03-2008 11:19 AM In reply to

    Re: How to use CreateZip and IsUnicodeText ?

    Hi,

    It can be pretty basic.

                FastZip zippy = new FastZip();
                ZipEntryFactory factory = new ZipEntryFactory();
                factory.IsUnicodeText = true;
                zippy.EntryFactory = factory;

    You could also typecast the initial factory and set it directly if you are so inclined.

    NOTE You can modify the library even though your application is closed source.  The requirement is that whatever mods you make to the library are made available.Not such a big deal.

    hth, -jr-

  • 09-04-2008 8:41 AM In reply to

    • DomZ
    • Top 500 Contributor
    • Joined on 09-01-2008
    • Posts 6

    Re: How to use CreateZip and IsUnicodeText ?

    Thanks, that's working great.

Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.