Here is the string I am trying to store
<div id="site-summary">
<p>
<strong>Welcome to Whiteley Helyar.</strong> We are independent, friendly and professional, always seeking to achieve the best for our clients. Whiteley Helyar is one of Bath’s leading residential estate agencies and deal only in sales – nothing else. Our many satisfied customers value our efficiency, honesty and expert understanding of property in Bath and the surrounding villages. Not only will you find us knowledgeable and helpful, we are also eager and progressive in our approach. If you are house-hunting in one of the UK’s most beautiful and vibrant cities, our experienced team of partners and negotiators can help you find the perfect property.
</p>
</div>
There is some unusual characters in here which is causing json_encode not to properly encode the string to json when it's in an array.
Here is my code where $about_us is the above string
$about_us = utf8_encode($about_us);
$about_us = htmlentities($about_us, ENT_QUOTES | ENT_IGNORE, "UTF-8");
$about_us = mysql_real_escape_string($about_us);
$link_array = array();
$link_array['stuff'] = 'other string';
$link_array['about_us'] = $about_us;
$json= json_encode($link_array);
I then store $json in a mysql text field. However. I can see from examining the $json string it's not valid json and fails on http://jsonlint.com/. And when I do a json_decode stuff works correctly but about us is empty.
This is what is in the database for the about_us property:
<div id="site-summary">\r\n <p><strong>Welcome to Whiteley Helyar.</strong> We are independent, friendly and professional, always seeking to achieve the best for our clients. Whiteley Helyar is one of Bathâu0080u0099s leading residential estate agencies and deal only in sales âu0080u0093 nothing else. Our many satisfied customers value our efficiency, honesty and expert understanding of property in Bath and the surrounding villages. Not only will you find us knowledgeable and helpful, we are also eager and progressive in our approach. If you are house-hunting in one of the UKâu0080u0099s most beautiful and vibrant cities, our experienced team of partners and negotiators can help you find the perfect property.</p>\r\n </div>
Any ideas please
Edit: This is different from the linked question since utf8_encode is not helping here (and that is the accepted answer for that question).