[英]While downloading files using MIME the file Name with non-english characters are not getting downloaded in .Net
嗨,当我尝试下载多个文件并将其压缩到一个 zip 文件中时,除了一个文件之外,不会下载所有其他文件。 文件名:答复정리答复정리.txt 在zip中其他文件都存在但除了这个
long[] fileIds = JsonConvert.DeserializeObject<long[]>(fileIdsStr);
string[] FileNames = JsonConvert.DeserializeObject<string[]>(FileNamesStr);
ZipOutputStream zipMemoryStream1 = new ZipOutputStream(Response.OutputStream);
int chunkSize = 1024;
string contentType = MimeMapping.GetMimeMapping("download_zip.zip");
foreach (long fileId in fileIds)
{
string fs_FileName = fs_FileNames[count];
string fileData = this.getFileData(fileId);
var bytes = Convert.FromBase64String(fileData);
var file = new ZipEntry(fs_FileName);
zipMemoryStream1.PutNextEntry(file);
byte[] buffer = new byte[chunkSize];
zipMemoryStream1.Write(bytes, 0, bytes.Length);
count++;
}
var cd = new System.Net.Mime.ContentDisposition();
cd.FileName = "download.zip";
Response.AppendHeader("Content-Disposition", cd.ToString());
Response.BufferOutput = false;
return File(zipMemoryStream1, contentType);
我制作文件.IsUnicodeText = true; 在 zip 中推送条目后,这可能是文件名中的编码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.