Delphi Unicode转中文编码


本文整理自网络,侵删。

 

function UnicodeToChinese(inputstr: string): string;
var
  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 编码的字符,如数字 delphitop.com
    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;

相关阅读 >>

Delphi idftp 详解

Delphi android 启动卡死处理方法

Delphi 实现窗体倒计时进度条显示

Delphi整理三(窗体和基本组件)

Delphi setcurrentdir 设置当前文件夹路径

Delphi 如何判断html编码格式,解决乱码问题

Delphi xe使用tjsonobject解析json数据

Delphi使用api实现模拟按键

Delphi 从listview组件中的选定行在数据库中删除

Delphi 一个整数转其二进制表示的小函数

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...