{感谢 robin(xuebin418@163.com)提供} //转换 function Str_Gb2UniCode(text: string): String; var i,len: Integer; cur: Integer; t: String; ws: WideString; begin Result := ''; ws := text; len := Length(ws); i := 1; while i <= len do begin cur := Ord(ws[i]); FmtStr(t,'%4.4X',[cur]); Result := Result + t; Inc(i); end; end; //恢复 function Unicode_str(text: string):string; var i,len: Integer; ws: WideString; begin ws := ''; i := 1; len := Length(text); while i < len do begin ws := ws + Widechar(StrToInt('$' + Copy(text,i,4))); i := i+4; end; Result := ws; end; //测试 procedure TForm1.Button1Click(Sender: TObject); begin ShowMessage(Str_Gb2UniCode('万一')); //4E074E00 ShowMessage(Unicode_str('4E074E00')); //万一 end;