Delphi中Unicode转中文

时间:2021-07-03 04:58:07
function UnicodeToChinese(inputstr: string): string;
var
i: Integer;
index: Integer;
temp, top, last: string;
begin
index := ;
while index >= do
begin
index := Pos('\u', inputstr) - ;
if index < then
begin
last := inputstr;
Result := Result + last;
Exit;
end;
top := Copy(inputstr, , index); // 取出 编码字符前的 非 unic 编码的字符,如数字
temp := Copy(inputstr, index + , ); // 取出编码,包括 \u,如\u4e3f
Delete(temp, , );
Delete(inputstr, , index + );
Result := Result + top + WideChar(StrToInt('$' + temp));
end;
end; https://blog.csdn.net/u012942868/article/details/52882736