//函数: 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;