When a Stack Snippet contains a NULL (U+0000) character in its body, various errors start to arise:
- Automatic POST requests to
/posts/validate-body
return a 418 No Reason Phrase error. - Trying to run the snippet the request to
https://stacksnippets.net/js
results in a 500 Internal Server Error. - Trying to save an edit the request to
/posts/[post-id]/edit-submit/
results in a 418 error too. - The "Review your Question" request to
/posts/validate-question
results in a 418 error. - Trying to post a question the request to
/questions/ask/submit
results in a 418 error. - ...
This doesn't seem to happen when this character is present anywhere else in the post; only in the content of a Stack Snippet.
I am not sure how bad it is. It happened to me because I added the results of a console's log as a comment in the JavaScript code, but one can certainly live without the ability to do this, or with this character getting replaced by � (U+FFFD) like it does anywhere else in the post body.
That said, I feel it was quite hard to find what was causing this issue, I guess at least the error message could be clearer, and well, I'm a bit scared by so many teapots in my console.
For the ones who want to try, here is a way to get this character:
console.log("copy this:\`" + new TextDecoder().decode(new Uint8Array([0])) + "\`");
Paste it anywhere in a Stack Snippet and try to run the snippet.