Deal with null characters in strings