Unicode includes several control codes, such as U+0000
(NULL, used in
null-terminated strings) and U+000D
(carriage return). This function
removes all such characters from text.
Details
Note: We highly recommend that you first condense all space-like characters
(including new lines) before removing control codes. You can easily do so
with str_squish
. We also recommend validating text at
the start of any cleaning process using validate_utf8
.