On 6/8/21 11:32 PM, ToddAndMargo via perl6-users wrote:
Hi Paul,

In "C", a chr(0), also called a "null" is a string
terminator.  In Raku, the terminator is in the
accompanying structure (hidden from you), when
says long the string is.

My guess as to what is happening is that the decode
function is simply giving you the ASCII (UTF-8)
value of chr(0).  And that decode thinks the length of
the resulting string is the length of the buffer,
also in a hidden structure.

I would use a loop and the chr function to
make my own decode and terminate early is it find
a chr(0).

Without all the typos:

Hi Paul,

In "C", a chr(0), also called a "null", is a string
terminator.  In Raku, the terminator is in the
accompanying structure (hidden from you), which
says long the string is.

My guess as to what is happening is the decode
function is simply giving you the ASCII (UTF-8)
value of chr(0).  And that decode thinks the length of
the resulting string is the length of the buffer,
also in a hidden structure.

I would use a loop and the chr function to
make my own decode and terminate early if it find
a chr(0).

-T

Reply via email to