title: Encoding in exported JAR
body: <p>I have problem with encoding in Java. I have set encoding in eclipse UTF-8. When I run my app from eclipse everything is ok but when I exported to jar and run it by double clicking I have ???? characters. When I run from command line: java -jar app.jar everything is ok. The problem is with downloaded data from other site (the site is utf8 encoded). What's the solution ?</p>
  
  <p><strong>EDIT:</strong>
  On all platforms, when I run from command line the defaultEncoding() is UTF-8. But when I run by double clicking:
  Mac: US-ASCII
  Windows: windows-1250</p>
  
  <p>I have wrote encoding method but it still not working:</p>
  
  <pre><code>public String getPageContent(String url) throws MalformedURLException, IOException
  {
      URL urlReader;
      InputStream response = null;
      BufferedReader reader;
      String pageContent = "";
      urlReader = new URL(url);
      response = urlReader.openStream();
      reader = new BufferedReader(new InputStreamReader(response));
  
  
      for (String line; (line = reader.readLine()) != null;) {
          pageContent += this.encode(line, "UTF-8");
  
      }   
      reader.close();
      return pageContent;        
  }
  public String encode(String s, String charset)
  {
          try {
              byte[] b = s.getBytes(charset);
              s = new String(b, charset);
              return s;
          } catch (UnsupportedEncodingException e1) {
  
  
      // TODO Auto-generated catch block
          e1.printStackTrace();
      }
      return s;
  </code></pre>
  
  <p>}</p>