如图,请教各位专家,压缩包使用VCLzip解压后文件名变成乱码。
var
M:TMemoryStream;
procedure TFormDownload.Download(Url:String);
begin
M:=TMemoryStream.Create;
try
try
Self.IdHTTP1.Get(Url,M);
except
end;
ForceDirectories(ExtractFileDir(Application.ExeName)+'\DownTemp');
if DirectoryExists(ExtractFileDir(Application.ExeName)+'\DownTemp') then
begin
M.SaveToFile(ExtractFileDir(Application.ExeName)+'\DownTemp\Rain.zip');
// Self.VCLUnZip1.ZipName:=ExtractFileDir(Application.ExeName)+'\DownTemp\Rain.zip';
M.Position:=0;
Self.VCLUnZip1.ArchiveStream:=M;
Self.VCLUnZip1.OverwriteMode:=Always;
Self.VCLUnZip1.ReadZip;
Self.VCLUnZip1.FilesList.Add('*.*');
Self.VCLUnZip1.DestDir:=ExtractFileDir(Application.ExeName)+'\DownTemp\';
Self.VCLUnZip1.DoAll := true;
Self.VCLUnZip1.RecreateDirs := true;
Self.VCLUnZip1.RetainAttributes := True;
Self.VCLUnZip1.UnZip;
Self.Timer.Enabled:=false;
end;
finally
FreeAndNil(M);
end;
Self.IdHTTP1.Disconnect;
end;
1 个解决方案
#1
const
s1 ='2017年国考行测真题地市级.zip';
s2 ='2015年国家公务员考试申论真题';
s3 = '2016年湖南公务员考试申论真题.doc';
procedure TForm1.btn1Click(Sender: TObject);
var
i:Integer;
begin
pm1.Paragraphs.Add(AnsiToUTF8(s1));
pm1.Paragraphs.Add(AnsiToUTF8(s2));
pm1.Paragraphs.Add(AnsiToUTF8(s3));
for i:=0 to 2 do
begin
pm1.Paragraphs.Add(UTF8ToAnsi(pm1.Paragraphs[i]));
end;
end;
2017骞村浗鑰冭娴嬬湡棰樺湴甯傜骇.zip
2015骞村浗瀹跺叕鍔″憳鑰冭瘯鐢宠鐪熼
2016骞存箹鍗楀叕鍔″憳鑰冭瘯鐢宠鐪熼.doc
2017年国考行测真题地市级.zip
2015年国家公务员考试申论真题
2016年湖南公务员考试申论真题.doc
#1
const
s1 ='2017年国考行测真题地市级.zip';
s2 ='2015年国家公务员考试申论真题';
s3 = '2016年湖南公务员考试申论真题.doc';
procedure TForm1.btn1Click(Sender: TObject);
var
i:Integer;
begin
pm1.Paragraphs.Add(AnsiToUTF8(s1));
pm1.Paragraphs.Add(AnsiToUTF8(s2));
pm1.Paragraphs.Add(AnsiToUTF8(s3));
for i:=0 to 2 do
begin
pm1.Paragraphs.Add(UTF8ToAnsi(pm1.Paragraphs[i]));
end;
end;
2017骞村浗鑰冭娴嬬湡棰樺湴甯傜骇.zip
2015骞村浗瀹跺叕鍔″憳鑰冭瘯鐢宠鐪熼
2016骞存箹鍗楀叕鍔″憳鑰冭瘯鐢宠鐪熼.doc
2017年国考行测真题地市级.zip
2015年国家公务员考试申论真题
2016年湖南公务员考试申论真题.doc