glaze icon indicating copy to clipboard operation
glaze copied to clipboard

Erroneous serialisation of char[4]

Open kaladron opened this issue 3 months ago • 3 comments

It appears that:

      char arr[4] = {0, 0, 1, 0};

Will currently serialise to "". I think (if I'm reading the JSON spec right) that it should serialise to "\u0000\u0000\u0001\u0000". I haven't tested to see if deserialising the array will work yet.

Thanks!

kaladron avatar Sep 18 '25 05:09 kaladron

Sorry, apparently me closing a PR to my own branch closed this. I'm still trying to figure out why unrelated tests are failing before I send the PR.

kaladron avatar Sep 22 '25 08:09 kaladron

Are you aware of the escape_control_characters option in Glaze? Did you try this? Glaze intentionally does not escape control characters (null included) when writing JSON. This is for performance and safety reasons.

stephenberry avatar Sep 22 '25 20:09 stephenberry

Ah, I hadn't been. I'll try that. I also tossed a PR your way as I hadn't seen this reply before sending. Sorry! I'll look in the morning.

kaladron avatar Sep 22 '25 22:09 kaladron