title: inputStream encoding issues (Special characters: ñ, á,...)
body: <p>Welcome all, I'm currently working on a web-service and I'm having a lot of trouble to make this method work with characters like ñ, ç, á, è,... It's seems to be related with my Input stream, it doesn't seem to be encoding properly, here's the code:</p>
  
  <pre><code>    private static String sendPost(String url, Map&lt;String, JSONObject&gt; params) throws Exception {
      String responseString;
  
      StringBuilder urlParameters = new StringBuilder(400);
      if (params != null) {
          for (Entry&lt;String, JSONObject&gt; entry : params.entrySet()) {
              urlParameters.append(entry.getKey()).append("=").append(entry.getValue().toString()).append("&amp;");
          }
  
      }
      url += urlParameters.toString();
      url = url.replace(" ", "%20");
      URL obj = new URL(url);
      HttpURLConnection con = (HttpURLConnection) obj.openConnection();
      con.setRequestMethod("POST");
      con.setRequestProperty("charset", "utf-8");
      con.setDoOutput(true);
      int responseCode = con.getResponseCode();
      if (responseCode == HttpStatus.SC_OK) {
          BufferedReader in = null;
          StringBuffer response = null;
          try{
              //when i check 'con' all seems to be fine
              in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
              String inputLine;
              response = new StringBuffer();
              while ((inputLine = in.readLine()) != null) {
                  response.append(inputLine);
              }
          }finally{
              in.close();
          }
          responseString = response.toString();
      } else {
          responseString = new StringBuilder(25).append(responseCode).toString();
      }
      return responseString;
  }
  </code></pre>
  
  <p>Example:
  Inside "con" http:\direction.dom\data\W-S\something?param={example:"castaña"}<br>
  and InputStream returns: http:\direction.dom\data\W-S\something?param={example:"casta�a"}</p>
  
  <p>Thanks in advance.</p>