#1 2023-11-09 11:41:44

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 56

Output parameters of the RawUtf8 type are incorrectly displayed

my code define as follows::

  IUserManage = interface(IInvokable)
  ['{970EB610-FC4B-4A89-9A39-2767A5100F97}']
    function chgMyPwd(oldPwd,newPwd:RawUtf8;hashed:Boolean;out errMsg:RawUtf8):boolean;
  end; 

  If errmsg returns a Chinese string, the client displays it incorrectly, but if errmsg is of type string, the return is correct.

  I don't know why.

Offline

#2 2023-11-09 16:13:08

tbo
Member
Registered: 2015-04-20
Posts: 335

Re: Output parameters of the RawUtf8 type are incorrectly displayed

lfyey121 wrote:

If errmsg returns a Chinese string, the client displays it incorrectly, but if errmsg is of type string, the return is correct. I don't know why.

With this minimal information, I can only guess:

var s: String := Utf8ToString(errMsg);

With best regards
Thomas

Offline

#3 2023-11-10 06:32:53

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 56

Re: Output parameters of the RawUtf8 type are incorrectly displayed

I tried it, but using Utf8ToString(errMsg) didn't solve the problem.
What happens to the RawUtf8 parameter? English can be returned normally.

Offline

#4 2023-11-10 07:37:27

zhangguichao
Member
Registered: 2023-03-21
Posts: 29

Re: Output parameters of the RawUtf8 type are incorrectly displayed

你可以试试这个: utf8tocp936(stringtoutf8(errMsg))

Offline

#5 2023-11-11 00:57:13

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 56

Re: Output parameters of the RawUtf8 type are incorrectly displayed

不行,我看了返回值的16进制数字,原始字符串:out测试,  返回的16进制表示:6F7574 C3A6C2B5C28B C3A8C2AFC295,正确的UTF8编码:6F7574 E6B58B E8AF95

Offline

Board footer

Powered by FluxBB