标准URL编码功能? [英] Standard URL encode function?

查看:254
本文介绍了标准URL编码功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 Url.UrlEncode()

注意

我几年没有和Delphi一起工作。
当我阅读了答案,我注意到有几个话题和替代当前标记的答案。我没有机会测试他们,所以我把我的答案放在最抢手的地方。

为了你自己的缘故,请检查后面的答案,并在决定upvote最好的答案,以便每个人都可以从中受益您的经验。

解决方案

查看indy IdURI单位,TIdURI类中有两个静态方法来编码/解码该URL。

 使用
IdURI;

..
begin
S:= TIdURI.URLEncode(str);
//
S:= TIdURI.URLDecode(str);
结束


Is there a Delphi equivalent of this .net's method:

Url.UrlEncode()

Note
I haven't worked with Delphi for several years now. As I read through the answers I notice that there are several remarks and alternatives to the currently marked answer. I haven't had the opportunity to test them so I'm basing my answer on the most upvoted.
For your own sake, do check later answers and after deciding upvote the best answer so everybody can benefit from your experience.

解决方案

Look at indy IdURI unit, it has two static methods in the TIdURI class for Encode/Decode the URL.

uses
  IdURI;

..
begin
  S := TIdURI.URLEncode(str);
//
  S := TIdURI.URLDecode(str);
end;

这篇关于标准URL编码功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆