1个回答
展开全部
你需要的是这样的函数吧? function AnsiToUnicode(Ansi: string):string; var s:string; i:integer; j,k:string[2]; a:array [1..1000] of char; begin s:=''; StringToWideChar(Ansi,@(a[1]),500); i:=1; while ((a<>#0) or (a[i+1]<>#0)) do begin j:=IntToHex(Integer(a),2); k:=IntToHex(Integer(a[i+1]),2); s:=s+k+j; i:=i+2; end; Result:=s; end; 附上反编码的函数 function ReadHex(AString:string):integer; begin Result:=StrToInt('$'+AString) end; function UnicodeToAnsi(Unicode: string):string; var s:string; i:integer; j,k:string[2]; begin i:=1; s:=''; while i<Length(Unicode)+1 do begin 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;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询