以下是将uniCode转换为中文的代码。
function TfrmMain.ReadHex(AString: string): integer;
begin
Result:=StrToInt('$'+AString)
end;
function TfrmMain.UnicodeToAnsi(Unicode: string): string;
var
s:string;
i:integer;
j,k:string[2];
begin
i:=1;
s:='';
while i j:=Copy(Unicode,i+2,2);
k:=Copy(Unicode,i,2);
i:=i+4;
s:=s+Char(ReadHex(j))+Char(ReadHex(k));
end;
if s<>'' then
s:=WideCharToString(PWideChar(s+#0#0#0#0))
else
s:='';
Result:=s;
end;
文章评论(0条评论)
登录后参与讨论