Hello all,
I’m having some trouble with PHP5 and . What i’ trying to do is convert all non breaking spaces into . I have UTF-8 in the meta tag of the html document. The text is sent through ajax and the escape() function from javascript is used on the text being sent.
On the server a PHP function collects the strings and should convert it to proper html. That is for example for each of the non breaking spaces.
What it does is adding a � instead.
Here’s my function:
$search = array(chr(9), chr(10), chr(160));
$replace = array(“t”, “n”, “ ”);
return $str_replace($search, $replace, $data);
But it still outputs the strange box. I’m using XML Dom method dom->saveHTML; which to outputs the html as (UTF8) to a string before I save it into a html file. Could the UTF8 cause this to happen?
After i’ve used My function above i use utf8-encode(html) to enable the output as utf8.
Please help
Adrian