- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi Unicode转换Ansi
function UnicodeToAnsi(aSubUnicode: string): string;
var
tmpLen, iCount: Integer;
tmpWS: WideString;
begin
tmpWS := '';
iCount := 1;
tmpLen := Length(aSubUnicode);
while iCount <= tmpLen do
try
if (Copy(aSubUnicode, iCount, 1) = '\')
and (Copy(aSubUnicode, iCount, 2) = '\u') then
begin
tmpWS := tmpWS
+ WideChar(StrToInt('$' + Copy(aSubUnicode, iCount + 2, 4)));
iCount := iCount + 6;
end
else
begin
tmpWS := tmpWS + Copy(aSubUnicode, iCount, 1);
iCount := iCount + 1;
end;
except
end;
Result := tmpWS;
end;