Closed jemc closed 2 years ago
This turned out to have nothing to do with null bytes - I got the diagnosis wrong when I wrote up this issue ticket.
In reality the bug I was seeing had to do with byte literals that happen to contain UTF-8 sequences in them, which was affecting the size
in Crystal to be different from the bytesize
.
See #303 for more information about the fix.
When a
String
orBytes
literal has multiple null bytes (\x00
) at its end, then only one of them ends up in the final string and the rest are getting trimmed.I suspect this may have something to do with how Crystal handles strings inside the compiler.