I have a field in a MySQL database (utf8_general_ci) that contains a curly (smart?) apostrophe: Owner’s...
This prints fine with no special handling if I access the PHP page that pulls it from the DB. However, I am trying to access it via a $.getJSON request on another page, so I used PHP's json_encode. It truncates the value so that it reads Owner
, then successfully encodes the rest of the data. If I use PHP's utf8_encode on the field before I json_encode, it includes the full value with the ’
encoded to \u0092
which then doesn't print anything on the page, giving me Owners
. PHP's htmlentities
and htmlspecialchars
have no effect.
Looking at the request in Chrome's tools, Owner’s
is shown as Owner�s
on the $.getJSON page.
Can anyone help me out here? I have read other questions on SO and the web but I cannot find anything that helps and I haven't worked much with JSON.
Thanks for reading.