title: Json_encode, json_decode and UTF8
body: <p>All,</p>
  
  <p>I make a JSON request to a web server using PHP and it returns me a JSON response in a variable. The JSON response will have lots of keys and values. The JSON response I get from the server has special characters in it. So, I use the following statement to convert it to UTF8,decode the JSON and use it as an array to display to the UI.</p>
  
  <pre><code>$response = json_decode(utf8_encode($jsonresponse));
  </code></pre>
  
  <p>Now, I have to pass the same value to the server in a JSON request to do some stuff. However, when I pass </p>
  
  <pre><code>$jsonrequest = json_encode(utf8_encode($request));
  </code></pre>
  
  <p>to the server, it fails.</p>
  
  <p>The following code succeeds in reading special characters and displaying it to the UI. But fails if I have to pass the utf8_encode value to the server.</p>
  
  <p>The current whole roundtrip code is as under:</p>
  
  <pre><code>$requestdata  = json_encode($request);
  $jsonresponse = //Do something to get from server;
  $response = json_decode(utf8_encode($jsonresponse));
  </code></pre>
  
  <p>How can I modify it such that I pass the exact value as to what I receieved from the json response from the server? </p>