title: Java UTF-8 encoding not set to URLConnection
body: <p>I'm trying to retrieve data from <a href="http://api.freebase.com/api/trans/raw/m/0h47">http://api.freebase.com/api/trans/raw/m/0h47</a></p>
  
  <p>As you can see in text there are sings like this:  <code>/ælˈdʒɪəriə/</code>.</p>
  
  <p>When I try to get source from the page I get text with sings like <code>&amp;#250;</code> etc.</p>
  
  <p>So far I've tried with the following code:</p>
  
  <pre><code>urlConnection.setRequestProperty("Accept-Charset", "UTF-8");
  urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>My entire code:</p>
  
  <pre><code>URL url = null;
  URLConnection urlConn = null;
  DataInputStream input = null;
  try {
  url = new URL("http://api.freebase.com/api/trans/raw/m/0h47");
  } catch (MalformedURLException e) {e.printStackTrace();}
  
  try {
      urlConn = url.openConnection(); 
  } catch (IOException e) { e.printStackTrace(); }
  urlConn.setRequestProperty("Accept-Charset", "UTF-8");
  urlConn.setRequestProperty("Content-Type", "text/plain; charset=utf-8");
  
  urlConn.setDoInput(true);
  urlConn.setUseCaches(false);
  
  StringBuffer strBseznam = new StringBuffer();
  if (strBseznam.length() &gt; 0)
      strBseznam.deleteCharAt(strBseznam.length() - 1);
  
  try {
      input = new DataInputStream(urlConn.getInputStream()); 
  } catch (IOException e) { e.printStackTrace(); }
  String str = "";
  StringBuffer strB = new StringBuffer();
  strB.setLength(0);
  try {
      while (null != ((str = input.readLine()))) 
      {
          strB.append(str); 
      }
      input.close();
  } catch (IOException e) { e.printStackTrace(); }
  </code></pre>