Delphi XE 10.2.3使用CEF4Delphi取网页元素时碰到变问号?的处理
用CEF4Delphi取网页元素时碰到ElementInnerText里含有" " 比如网页源码里是"内容 "取出来显示就变成"内容?" 搜索大部分是说把" "替换成其它字符即可 但实际操作怎么也替换不了,就算变量为AnsiString也不行 最后用了以下方法解决 参考网页: https://blog.csdn.net/qq_29683707/article/details/80860904
要用到encodeURI,找到Delphi版的 http://www.delphitop.com/html/zifuchuan/2599.html ?
使用方法2的TIdURI.URLEncode,程序出错,原因不明 使用方法1成功 直接 TmpTitle:= HTTPEncode(TmpTitle); 即可 但编译器提示警告
? 意思是HTTPEncode和HTTPDecode已经弃用请用TNetEncoding.URL.Encode和TNetEncoding.URL.Decode 点进HTTPEncode看看 function HTTPDecode(const AStr: string): string; begin Result := TNetEncoding.URL.Decode(AStr); end; function HTTPEncode(const AStr: string): string; begin Result := TNetEncoding.URL.Encode(AStr); end; 其实就直接调用了 TNetEncoding.URL.Encode 所在单元是 System.NetEncoding (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |