This adds a new function, zend_tombs_string_escape, which copies a string, doubling backslashes to escape them. So the string "a\b\c" becomes "a\\b\\c". This is important when dumping JSON, since currently namespaces cause tombs to emit invalid JSON. I imagine there are also problems with Windows file paths, but I don't use Windows so can't say for sure.
I've arbitrarily limited the strings to 256 bytes. This seems like it should be plenty but I'm open to feedback. Strings beyond that length are truncated.
Fixes #12 for the most part. There are still cases where invalid JSON can be emitted, but they should be much less common.
This adds a new function,
zend_tombs_string_escape
, which copies a string, doubling backslashes to escape them. So the string"a\b\c"
becomes"a\\b\\c"
. This is important when dumping JSON, since currently namespaces cause tombs to emit invalid JSON. I imagine there are also problems with Windows file paths, but I don't use Windows so can't say for sure.I've arbitrarily limited the strings to 256 bytes. This seems like it should be plenty but I'm open to feedback. Strings beyond that length are truncated.
Fixes #12 for the most part. There are still cases where invalid JSON can be emitted, but they should be much less common.