title: How to handle UNICODE URL?
body: <p>If I want to pase the following URL's in Java:</p>
  
  <p><img src="https://i.stack.imgur.com/3IG9m.png" alt="Screenshot of URL&#39;s in UNICODE"></p>
  
  <p>... what handle should I have with the String.</p>
  
  <p>So far I have been unable to handle that String's, all I've got are ???? chars.</p>
  
  <p>Thanks.</p>
  
  <p>Modified in 2012.09.09:</p>
  
  <pre><code>package pruebas;
  
  import java.io.UnsupportedEncodingException;
  import java.net.URL;
  import java.net.URLConnection;
  import java.net.URLDecoder;
  import java.net.URLEncoder;
  import java.util.Vector;
  
  public class Prueba03
  {
      public static void main(String argumentos[])
      {
          Vector&lt;String&gt; listaURLs = new Vector&lt;String&gt;();
  
          listaURLs.add("http://президент.рф/");
          listaURLs.add("http://www.中国政府.政务.cn");
          listaURLs.add("http://www.原來我不帥.cn/");
          listaURLs.add("http://وزارة-الأتصالات.مصر/");
  
          URL currentURL;
          URLConnection currentConnection;
          int currentSize;
  
          for(int i=0; i&lt;listaURLs.size(); i++)
          {
              try
              {
                  System.out.println(URLDecoder.decode(listaURLs.get(i), URLEncoder.encode(listaURLs.get(i), "UTF-8")));
              } // End of the try.
              catch(UnsupportedEncodingException uee)
              {
                  uee.printStackTrace();
              } // End of the catch.
              catch(Exception e)
              {
                  e.printStackTrace();
              } // End of the catch.
  
              try
              {
                  currentURL = new URL(listaURLs.get(i));
                  System.out.println("currentURL" + " = " + currentURL);
  
                  currentConnection = currentURL.openConnection();
                  System.out.println("currentConnection" + " = " + currentConnection);
  
                  currentSize = currentConnection.getContentLength();
                  System.out.println("currentSize" + " = " + currentSize);
              } // End of the try.
              catch(Exception e)
              {
                  e.printStackTrace();
              } // End of the catch.
          } // End of the for.
      } // End of the main method.
  } // End of the Prueba02 class.
  </code></pre>