I need to clean a string that comes (copy/pasted) from various Microsoft Office suite applications (Excel, Access, and Word), each with its own set of encoding.
I\'m
I just had the same problem. Apparently PHP's json_encode will return null for any string with a 'non-breaking space' in it.
The Solution is to replace this with a regular space:
str_replace(chr(160),' ');
I hope this helps somebody - it took me an hour to figure out.