Replaces invalid UTF-8 sequences with U+FFFD (if there's enough space,) and Newlines with '\n'.
The string to be sanitized; no new memory is allocated.
See Implementation
Replaces invalid UTF-8 sequences with U+FFFD (if there's enough space,) and Newlines with '\n'.