title: What is wrong with this URI URL? IllegalArgumentException, Illegal character
body: <p>I'm getting an error:</p>
  
  <pre><code>W/System.err(32720): java.lang.IllegalArgumentException: Illegal character in query at index 89: https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f={%20mean0%22:%201}&amp;apiKey=myApiKey
  
  
  String apiURI = "https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f={%22mean0%22:%201}&amp;apiKey=myApiKey";
  </code></pre>
  
  <ul>
  <li>When I paste this URI into the browser it works fine.</li>
  <li>When I paste into browser, open it, and then copy the URI back into my code, it does not help.</li>
  <li>Index 89 is { - how is that an illegal character?</li>
  </ul>
  
  <p>I tried doing this - replacing curly brackets with %7B: but it does not help</p>
  
  <pre><code>https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f=%7B"mean0":%201%7D&amp;apiKey=myApiKey
  </code></pre>
  
  <p>Anyone?</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <pre><code>    String query = "https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f={\""+arrayName+"\":%201}&amp;apiKey=myApiKey";
      try {
          query = URLEncoder.encode(query, "utf-8");
      } catch (UnsupportedEncodingException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
      }
      String apiURI = query;
  </code></pre>
  
  <p>Does not help. Now I'm getting:</p>
  
  <pre><code>05-23 22:13:21.855: E/SendMail(12428): Target host must not be null, or set in parameters. scheme=null, host=null, path=https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f={"mean0":%201}&amp;apiKey=myAPI
  </code></pre>
  
  <p>and if I change %20 to a space in the declaration of query then I'm getting:</p>
  
  <pre><code> 05-23 22:14:51.435: E/SendMail(13164): Target host must not be null, or set in parameters. scheme=null, host=null, path=https://api.mongolab.com/api/1/databases/activity_recognition/collections/entropy_data?f={"mean0":+1}&amp;apiKey=myAPI
  </code></pre>
  
  <p><strong>Also If I dont use the arrayName string in the middle and just use string straight from browser, effect is the same!</strong></p>