I give up trying to solve this by myself, I need help! I have been working on a WordPress project that has a few features working with AJAX. After updating PHP to 5.6 (as the latest WordPress requested), many of my AJAX functions are broken because of a mysterious no-break line character %a0
appearing in its response and breaking the JSON structure.
The response is from json_encode()
.
JSON response I am getting:
{
"term_id":75,
"name":"iPhone
3G",
"slug":"iphone-3g"
},
Investigation:
After many hours of reading about this, I tried several solutions that worked for others, but they didn't work for me.
magic_quotes_gpc
in php.inipreg_replace
on the server side for all different no-break/new-line special charactersstr.replace
I checked the database, and there is no %a0
for that entry, there is a space %20
, which is correct. I also noticed that if I remove that space, this happens to the next item that has a space %20
.
I should also mention that this example above with the iPhone 3G is not unique. After this item, a few items are cleared (even those with space %20
) but then it happens again later on down the latter with other items, same situation.
So it appears that PHP is replacing %20
with %a0
every so often.
What should I do?