I send json_encoded data from my PHP server to iPhone app. Strings containing html entities, like '&' are escaped by json_encode and sent as &.
I am looking to do one of two things:
-
make
json_encodenot escape html entities. Doc says ‘normal’ mode shouldn’t escape it but it doesn’t work for me. Any ideas? -
make the iPhone app un-escape html entities cheaply. The only way I can think of doing it now involves spinning up a
XML/HTML parserwhich is very expensive. Any cheaper suggestions?
Thanks!
Neither PHP 5.3 nor PHP 5.2 touch the HTML entities.
You can test this with the following code:
You’ll see the only thing PHP does is to add double quotes around the string.