str_replace("\u00a0", " ", utf8_encode($dat)). But that didn't fix it.
PHP only has byte strings, not native Unicode strings; consequently there is no \u
escape and you were asking it literally to convert backslash-letter-u sequences in the input.
To get rid of non-breaking space characters you would have to replace away \xA0
(if done over the ISO-8859-1 data you presumably have before passing to utf8_encode
), or \xC2\xA0
(if done after transcoding to UTF-8).
utf8_encode
only transcodes ISO-8859-1 to UTF-8, it doesn't touch spaces, so my suspicion is you have non-breaking space characters in your actual data.