title: Sysout prints unreadable characters when the java program is run on unix
body: <p>Before tagging this as duplicate, answer this question first. I have been searching and cannot resolve this with the answers from the previous related questions.</p>
  
  <p>I have a Java program that prints text on the console.During my test on Eclipse, the text is readable. However, this Java program is intended to be called by a Unix job. But when I open the joblog the text is unreadable.</p>
  
  <pre><code>d^@^C????^D^F?`^T??Q0(????c?Z1?^
  </code></pre>
  
  <p>I tried to change my code in Java by defining the character encoding on the Sysout, but neither of the code below worked.</p>
  
  <pre><code>System.setOut(new PrintStream(System.out, true, "ASCII"));
  
  System.setOut(new PrintStream(System.out, true, "UTF-8"));
  </code></pre>
  
  <p>The joblog is on ASCII format.</p>
  
  <pre><code>$file myFile.txt
  myFile.txt: ascii text
  </code></pre>