Delphi中Unicode转中文

Posted westsoft

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Delphi中Unicode转中文相关的知识,希望对你有一定的参考价值。

function UnicodeToChinese(inputstr: string): string;  
var  
    i: Integer;  
    index: Integer;  
    temp, top, last: string;  
begin  
    index := 1;  
    while index >= 0 do  
    begin  
        index := Pos(u, inputstr) - 1;  
        if index < 0 then  
        begin  
            last := inputstr;  
            Result := Result + last;  
            Exit;  
        end;  
        top := Copy(inputstr, 1, index); // 取出 编码字符前的 非 unic 编码的字符,如数字  
        temp := Copy(inputstr, index + 1, 6); // 取出编码,包括 u,如u4e3f  
        Delete(temp, 1, 2);  
        Delete(inputstr, 1, index + 6);  
        Result := Result + top + WideChar(StrToInt($ + temp));  
    end;  
end;  

https://blog.csdn.net/u012942868/article/details/52882736

 



以上是关于Delphi中Unicode转中文的主要内容,如果未能解决你的问题,请参考以下文章

DELPHI2010显示中文乱码

delphi 中文奇数乱码

Utf8编码转换问题 Delphi

在 Delphi 2009 的 Rave Reports 中显示 unicode 文本

Delphi7中 string, AnsiString, Utf8String,WideString的区别分析(转)

delphi打开unicode文件的问题