Encodeing results are not working
<p>I have a program written in Delphi 4 and trying to convert it to delphi xe10. One part i do not understand is this. </p>

<pre><code>    Cmd[0] := 2;                   // Number of equipment to talk to
    Cmd[1] := 22;                  // My device address
    Cmd[2] := 0;
    MResults.Lines.Add('Reciving...');
    Refresh();

    Srlen := High(RecBuff);                               

     Ret := GpListen(@Cmd, @Srlen, @RecBuff);              // gets returned value
    if CheckRet('GpListen', (Ret and $FF), csBuf) = 0 then 
    begin
        RecBuff[Srlen] := Chr(0);                            // ??
        MResults.Lines.Add(RecBuff);               // returned 
        //csBuf := Format('????', [Srlen]); ////?some error??
    end;
</code></pre>

<p>The issue is RecBuff (RecBuff:array[0..9999] of Char;) It starts off full of #0  like so:</p>

<p><a href="https://i.stack.imgur.com/i1fWY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i1fWY.jpg" alt="enter image description here"></a></p>

<p>but as soon as </p>

<pre><code>Ret := gpListen(@cmd, @srlen, @recbuff); 
</code></pre>

<p>is ran recbuff now looks like this:</p>

<p><a href="https://i.stack.imgur.com/Dzx2c.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Dzx2c.jpg" alt="enter image description here"></a>
alot of japan char.  how do i get this to encode onto the memopad correctly. </p>