title: java JSON text encoding issue
body: <p>In my application I retrieve search results in JSON format from an external tool called Google Search Appliance(GSA).</p>
  
  <p>The JSON result from GSA is very large and therefore I prefer to modify the GSA JSON result into something more suitable for displaying on my webpage.</p>
  
  <p>If I directly display the GSA JSON result without formatting it in my java code I'm not facing any encoding issues on my webpage.</p>
  
  <p>But if I format the large GSA JSON result into a suitable JSON format in my servlet java code I'm facing encoding problems.
  Example -  <code>“All Access Pass”</code>  gets displayed as <code>ÂAll Access PassÂ</code>.</p>
  
  <p>I return the modified json from my servlet to the webpage use the following code - </p>
  
  <pre><code>response.setContentType("application/json;charset=UTF-8");
  </code></pre>
  
  <p>I have tried to change the charset to <code>iso-8859-1</code> but it does not make any difference.</p>
  
  <p>I edit my original JSON in the following manner - </p>
  
  <pre><code>        String responseText = getMethod.getResponseBodyAsString();
  
          JSONObject resultJSON = new JSONObject();
                  try {
  
                      JSONObject jsonObj = new JSONObject(responseText);
  
                      JSONArray resultJsonArray = jsonObj
                              .getJSONArray("RES");
  
                      JSONObject searchResultJSON = null;
  
                      for (int iCnt = 0; iCnt &lt; resultJsonArray.length(); iCnt++) {
  
                          searchResultJSON = new JSONObject();
  
                          JSONObject obj = resultJsonArray.getJSONObject(iCnt);
                          JSONObject metaTagObj = obj
                                  .getJSONObject("MT");
  
                          if (metaTagObj.has(("title"))) {
                           searchResultJSON.put("title",metaTagObj.get("title").toString());
                          }
               resultJSON.accumulate("RES", searchResultJSON);
      }
     response.setContentType("application/json;charset=UTF-8"); 
     response.getWriter().print(resultJSON);
  
      }catch(JSONException e){}
  </code></pre>
  
  <p>The modification to the original JSON which I'm going here can be done in JavaScript which would solve my problem but it is something which I do not want to do.</p>
  
  <ol>
  <li>Is there a way to find out the encoding format of the text in the original GSA JSON?</li>
  <li>How can I avoid the java code from changing the text encoding in the original GSA JSON?</li>
  </ol>
  
  <p>Please help me understand what is going on here and how I can avoid this problem.   </p>