UrlDownloadToFile 下载不了中文名文件
通过一个html页面,调用activex。html页面的charset=gb2312,运行时需要先下载图片到某个盘的文件夹下,现在由于有中文名图片,下载不成功。
function DownloadFile(Source, Dest: string): Boolean;
begin
try
Result := UrlDownloadToFile(nil, PChar(source), PChar(Dest), 0, nil) = 0;
except
Result := False;
end;
end;
以上是下载写的方法。后来找了点资料改成下面的代码
function DownloadFile(Source, Dest: string): Boolean;
begin
try
Result := UrlDownloadToFile(nil, PChar(urlencode(utf8encode(source))), PChar(urlencode(utf8encode(Dest))), 0, nil) = 0;
except
Result := False;
end;
end;
还是不行。请大家指教一下有什么好的办法。另说明:应要求中文名文件不能改为英文名