我在delphi中研究微信的功能,能够发送出去消息,英文字符都没问题,就是中文一发出去就变成了\u8212\u670d\u8212\u670d就是这种东西了,我不知道用TWebBrowser怎么设置请求头,试了很多种,都不管用,发出去的中文,总是那种样子,有大神知道怎么处理的么,多谢

解决方案 »

  1.   

    以前有封装了个函数可以转
    class function UnicodeToChinese(source: string): string;
    var
      i: Integer;
      index: Integer;
      temp,top,last: string;
    begin
      index := 1;
      while index >= 0 do
      begin
        index := Pos('\u', source) - 1;
        if index < 0 then
        begin
          last := source;
          result := result + last;
          exit;
        end;
        top := Copy(source, 1, index);
        temp := Copy(source, index + 1, 6);
        Delete(temp, 1, 2);
        Delete(source,1,index + 6);
        result := result + top + WideChar(StrToInt('$' + temp));
      end;
    end;调用:
    ShowMessage(UnicodeToChinese('\u8212\u670d\u8212\u670d'));显示的是:舒服舒服
      

  2.   

    幸会啊,骨灰级人物。 
    啥时候CSDN把注册时长都给暴露了我都不知道 
      

  3.   

    幸会啊,骨灰级人物。 
    啥时候CSDN把注册时长都给暴露了我都不知道 还算不上骨灰级,注册19年=金牌选手,注册18年=银牌选手,注册17年=铜牌选手~~~
      

  4.   

    天行归来,我是在Delphi程序里面都是正常的,就是微信里看到的是unicode码,毕竟发送微信消息是在delphi程序里发的,就是微信里看到的不是中文
      

  5.   

    使用UTF-8编码发送消息试试