title: Send UTF-8 chars via HttpURLConnection failing
body: <p>I have spent half Sunday on this now I need help:</p>
  
  <p>I want to send a String including special chars UTF-8 encoded to a server using Java HttpURLConnection. The correct encoding of the chars fails.</p>
  
  <p>Example:</p>
  
  <pre>
  strToSend: ä ù €
  strUrlEncoded: %C3%A4+%C3%B9+%E2%82%AC
  strReceived:Ã¤ Ã¹ â¬
  </pre>
  
  <p>My code:</p>
  
  <pre><code>        urlConnection = (HttpURLConnection) new URL("http://localhost:8080/NetworkingServer/ServerServlet").openConnection();
          urlConnection.setUseCaches(false);
          urlConnection.setDoOutput(true); // Triggers POST.
          urlConnection.setRequestProperty("accept-charset", "UTF-8");
          urlConnection.setRequestProperty("content-type", "application/x-www-form-urlencoded");
  
          String strToSend = "ä ù €";
          System.out.println("strToSend: " + strToSend);
          String strUrlEncoded = URLEncoder.encode(strToSend, "UTF-8");
          System.out.println("strUrlEncoded: " + strUrlEncoded);
  
          OutputStreamWriter writer = new OutputStreamWriter(urlConnection.getOutputStream(), "UTF-8");
          writer.write(String.format("content=%s", strUrlEncoded));
          writer.close();
  </code></pre>
  
  <p>Any ideas?</p>