function TForm1.AnsiToUnicode(Str: ansistring): string;
var
s: ansistring;
i:integer;
j,k:string[2];
a:array [1..1000] of ansichar;
begin
s:='';
StringToWideChar(Str,@(a[1]),500);
i:=1;
while ((a[i]<>#0) or (a[i+1]<>#0)) do
begin
j:=IntToHex(Integer(a[i]),2);
k:=IntToHex(Integer(a[i+1]),2);
s:=s+'\u'+k+j;
i:=i+2;
end;
Result:=s;
end;
delphi Ansi字符串转Unicode编码
最新推荐文章于 2024-09-22 09:08:30 发布