delphi将字符串转换成UTF8编码的函数


本文整理自网络,侵删。

 //函数:
function ToUTF8Encode(str: string): string;
var
b: Byte;
begin
for b in BytesOf(UTF8Encode(str)) do
Result := Format('%s%s%.2x', [Result, '%', b]);
end;

//测试:
var
str: string;
begin
str := '三生有幸网';
str := ToUTF8Encode(str);
ShowMessage(str); //%E4%B8%87%E4%B8%80
end;

相关阅读 >>

Delphi递归删除列表文件以外的所有文件

Delphi integer.tryparse

Delphi url解�a函��(by kingron)

indy断点续传

Delphi 解决timage无法在窗体resize时改变canvas的大小

Delphi twebbrowser出现 method pastehtml not supported by automation object 解决方法

Delphi 基础学习 字符串去掉回车符

Delphi datasnap 上传/下载大文件(本demo以图传片文件为例)

Delphi 倒计时对话框

Delphi createdir 建立文件夹路径

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...