All,
I am making a JSON request to a web server using PHP and returning a JSON response in a variable. The JSON response will have many keys and values. The JSON response that I get from the server contains special characters in it. Therefore, I use the following operator to convert it to UTF8, decode JSON and use it as an array for display in the user interface.
$response = json_decode(utf8_encode($jsonresponse));
Now I have to pass the same value to the server in the JSON request to do something. However, when I transmit
$jsonrequest = json_encode(utf8_encode($request));
to the server, it does not work.
The following code succeeds in reading special characters and displaying it in the user interface. But it crashes if I need to pass the utf8_encode value to the server.
Current current round-trip code:
$requestdata = json_encode($request);
$jsonresponse =
$response = json_decode(utf8_encode($jsonresponse));
, , json ?