双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

UrlDownloadToFile 下载不了中文名文件

landixin landixin 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
通过一个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;
还是不行。请大家指教一下有什么好的办法。另说明:应要求中文名文件不能改为英文名
...全文

相关推荐

评论 19
收藏 已收藏
分享
返回顶部
landixin
Delphi 5,944 成员 262,941 内容