Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The issue you have is most likely caused by incorrect setting of the character encoding at the point that you are reading in the http response from google. Can you post the code that actually gets URL and parses it into the JSON object?</p> <p>As an example run the following:</p> <pre><code>public class Test1 { public static void main(String [] args) throws Exception { // just testing that the console can output the correct chars System.out.println("\"title\":\"مطبخ مطايب - كباب الدجاج والخضار بصلصة الروب"); URL url = new URL("http://ajax.googleapis.com/ajax/services/search/web?start=0&amp;rsz=large&amp;v=1.0&amp;q=rz+img+news+recordid+border"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); InputStream is = connection.getInputStream(); // the important bit is here..........................\/\/\/ InputStreamReader reader = new InputStreamReader(is, "utf-8"); StringWriter sw = new StringWriter(); char [] buffer = new char[1024 * 8]; int count ; while( (count = reader.read(buffer)) != -1){ sw.write(buffer, 0, count); } System.out.println(sw.toString()); } } </code></pre> <p>This is using the rather ugly standard <code>URL.openConnection()</code> that's been around since the dawn of time. If you are using something like <a href="http://hc.apache.org/httpclient-3.x/" rel="nofollow noreferrer">Apache httpclient</a> then you can do this really easily.</p> <p>For a bit of back ground reading on encoding and maybe an explaination of why <code>new String (str.getBytes(), "UTF8");</code> will never work read <a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="nofollow noreferrer">Joel's article on unicode</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload