UTF8String type
-----------------------------------------------------------------------
UTF8String represents a string in the UTF-8 character set.
Unit
System
typedef AnsiString UTF8String;
Description
UTF8String is the type for strings encoded using UTF-8. UTF-8 is an efficient encoding of Unicode character-strings that recognizes the fact that the majority of text-based communications are in ASCII, and optimizes the encoding of these characters.
原来代码是这样:
function TPduPush.StrToUTF8(str: WideString): string;
var
s: pchar;
i: integer;
tmp: string;
begin
tmp := '';
result := '';
s := pchar(Utf8encode(str));
for i := 0 to length(s) - 1 do begin
tmp := tmp + format('%2.2x', [ord(s[i])]);
end;
result := tmp;
end;