本文整理自网络,侵删。
//函数:
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 设置webbrowser 代理服务器 与 useragent
Delphi 如何把程序钉到windows7任务栏(修正版)
更多相关阅读请进入《Delphi》频道 >>