C #. NET uses the DotNetZip open source class library to handle compression/decompression ZIP handling garbled cases

Source: Internet
Author: User

DotNetZip on codeplex:http://dotnetzip.codeplex.com/

Compression:

//1. Compression//specify encoding to prevent Chinese garbled situation            using(ZipFile zip =NewZipFile (System.Text.Encoding.UTF8)) {                //Add this map file to the "Images" directory in the ZIP archive to the "Images" directory in the ZIP archiveZip. AddFile (@"E:\DemoZip\1.png","Images"); //Add the report to a different directory in the archive adds reports to other directories in the archiveZip. AddFile (@"E:\DemoZip\2.txt","Files"); //add to root directoryZip. AddFile (@"E:\DemoZip\3.txt"); Zip. Save (@"E:\DemoZip\ZipFile.zip"); }            //2. Unzip//specify encoding to prevent the presence of Chinese garbled characters//if case: The path has illegal characters            using(ZipFile zip =NewZipFile (@"E:\DemoZip\ZipFile.zip", System.Text.Encoding.UTF8)) {zip. Extractall (@"E:\DemoZip\ZipFileFolder", extractexistingfileaction.overwritesilently); }

C #. NET uses the DotNetZip open source class library to handle compression/decompression ZIP handling garbled cases

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.