But what is the vulnerability? And what is a null character doing in a text document?
If you are just worried about data loss, having null allowed in text segments is already begging for failure, as C programs will almost certainly get them wrong.
If you are transferring binary, base64 or similar will already cover you.
And again, if this is a strike on xml, how do you represent NaN in a JSON document? Do what DynamoDB does and wrap all numbers in quotes?