The recent use of this function, helpless did not find the Delphi brought, online looked for a similar, there is no ready, I need to support the "\u4f00" this format, that is, the front with the standard "\u" so modified a bit.
Here is the decoding function:
It's convenient for those who need it, and I need ^_^ myself.
///<summary> ////// Unicode to Chinese characters, supports automatic filtering of non-Unicode encodings, i.e. non-Unicode encoding does not convert ///supports only standard type \u4e00 conversions of this format, starting with \u ///code by ape brother 2015-2-11 ///</summary> functionTmyencode.unicodetochinese (inputstr:string):string;varI:integer;index:integer;temp,top,last:string;beginIndex:=1; whileindex>=0 Do beginIndex:= Inputstr. IndexOf ('\u'); ifindex<0 ThenbeginLast :=Inputstr; Result:= result+Last ; Exit;End; Top:= Copy (Inputstr,1, index);//Remove the non-UNIC encoded characters, such as numbers, before the encoded characterstemp:= Copy (inputstr,index+1,6);//remove the code, including \u, such as \u4e3fDelete (temp,1,2); Delete (Inputstr,1, index+6); Result:= result+ top+ Widechar (Strtoint ('$'+temp)) ; End;End;
The Unicode to Chinese character function in Delphi