I am using echo in php to return a database request. When trying to decode the result in Flash I get errors telling me of unexpected characters. When I looked at the output in the browser it looked fine. But when I copied the contents (Select All -> Copy) and then ran the text through a script in php I saw a lot of strange characters. This explains why the JSON decoding fails, but how do I get rid of the strange characters?
Test script to check the string
$string = str_split($string);
echo '<pre>';
print_r($string);
echo '<pre>';
Result:
[0] => ï
[1] => »
[2] => ¿
[3] => ï
[4] => »
[5] => ¿
[6] => ï
[7] => »
[8] => ¿
...