\u65b0\u6d6a\u4f53\u80b2\ 这样的如何转成文字?
一个网页里面存在\u65b0\u6d6a\u4f53\u80b2\的字符串,如何转成字符啊?
[解决办法]
- Delphi(Pascal) code
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;procedure TForm1.Button1Click(Sender: TObject);begin showmessage(UnicodeToAnsi('\u65b0\u6d6a\u4f53\u80b2'));//显示“新浪体育”end;