title: java.lang.IllegalArgumentException: Illegal character in query at index 59
body: <p><strong>What i am doing:</strong>
  I am trying to make a reverse geocoding in android</p>
  
  <p><strong>I am getting error as::</strong>
  java.lang.IllegalArgumentException: Illegal character in query at index 59: <a href="http://maps.google.com/maps/api/geocode/json?address=Agram" rel="noreferrer">http://maps.google.com/maps/api/geocode/json?address=Agram</a>, Bengaluru, Karnataka, India&amp;sensor=false</p>
  
  <p>NOte: that request gets a json response in browser but not from my class below</p>
  
  <p><strong><em>This line is giving this error::</em></strong></p>
  
  <pre><code>HttpGet httpget = new HttpGet(url);
  </code></pre>
  
  <hr>
  
  <p><strong>JSONfunctions.java</strong></p>
  
  <pre><code>public class JSONfunctions {
  
      public static JSONObject getJSONfromURL(String url) {
          InputStream is = null;
          String result = "";
          JSONObject jArray = null;
  
          // Download JSON data from URL
          try {
              HttpClient httpclient = new DefaultHttpClient();
              HttpGet httpget = new HttpGet(url);
  
              HttpResponse response = httpclient.execute(httpget);
              HttpEntity entity = response.getEntity();
              is = entity.getContent();
  
          } catch (Exception e) {
              Log.e("log_tag", "Error in http connection " + e.toString());
          }
  
          // Convert response to string
          try {
              BufferedReader reader = new BufferedReader(new InputStreamReader(
                      is, "iso-8859-1"), 8);
              StringBuilder sb = new StringBuilder();
              String line = null;
              while ((line = reader.readLine()) != null) {
                  sb.append(line + "\n");
              }
              is.close();
              result = sb.toString();
          } catch (Exception e) {
              Log.e("log_tag", "Error converting result " + e.toString());
          }
  
          try {
  
              jArray = new JSONObject(result);
          } catch (JSONException e) {
              Log.e("log_tag", "Error parsing data " + e.toString());
          }
  
          return jArray;
      }
  }
  </code></pre>