可以支持文件夹压缩啊,不知你是怎么调用的,我把文件\Zip\ZipConstants.cs 中的内容改成(如下)就支持中文文件名了,原来中文解压后会变成下划线了。
------------------------------------------------------------
public static string ConvertToString(byte[] data)

return Encoding.GetEncoding(936).GetString(data,0, data.Length);
}public static byte[] ConvertToArray(string str)
{
return Encoding.GetEncoding(936).GetBytes(str);
}

解决方案 »

  1.   

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;using ICSharpCode.SharpZipLib.Zip;
    using System.IO;namespace CSharpZipFileTest
    {
    /// <summary>
    /// Summary description for index.
    /// </summary>
    public class index : System.Web.UI.Page
    {
    private void Page_Load(object sender, System.EventArgs e)
    {
    // Put user code to initialize the page here
    this.dlZipDir(@"D:\dir","zipTest");  } #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {    
    this.Load += new System.EventHandler(this.Page_Load);
    }
    #endregion ZipOutputStream zos=null;
    String strBaseDir="";
    private void dlZipDir(string strPath,string strFileName)
    {
    MemoryStream ms =null;
    Response.ContentType = "application/octet-stream";
    strFileName=HttpUtility.UrlEncode(strFileName).Replace('+',' ');
    Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName+".zip");
    ms = new MemoryStream();
    zos = new ZipOutputStream(ms);
    strBaseDir=strPath+"\\";
    addZipEntry(strBaseDir);
    zos.Finish();
    zos.Close();
    Response.Clear();
    Response.BinaryWrite(ms.ToArray());
    Response.End();
    }
     
    private void addZipEntry(string PathStr)
    {
    DirectoryInfo di= new DirectoryInfo(PathStr);
    foreach(DirectoryInfo item in di.GetDirectories())//遍历出所有目录
    {
    addZipEntry(item.FullName);
    }
    foreach(FileInfo item in di.GetFiles())//遍历出所有文件
    {
    FileStream fs = File.OpenRead(item.FullName);
    byte[] buffer = new byte[fs.Length];
    fs.Read(buffer, 0, buffer.Length);
    string strEntryName=item.FullName.Replace(strBaseDir,"");//替换路径
    ZipEntry entry = new ZipEntry(strEntryName);
    zos.PutNextEntry(entry);
    zos.Write(buffer, 0, buffer.Length);
    fs.Close();
    }
    }
    }
    }
    你试试。
      

  2.   

    http://www.ftponline.com/china/XmlFile.aspx?ID=278
    看看这编文章吧