title: Determining ISO-8859-1 vs US-ASCII charset
body: <p>I am trying to determine whether to use</p>
  
  <pre><code>PrintWriter pw = new PrintWriter(outputFilename, "ISO-8859-1");
  </code></pre>
  
  <p>or</p>
  
  <pre><code>PrintWriter pw = new PrintWriter(outputFilename, "US-ASCII");
  </code></pre>
  
  <p>I was reading <a href="https://www.garron.me/en/linux/charset-encoding-html-change.html" rel="nofollow">All about character sets</a> to determine the character set of an example file which I must create in the same encoding via java code.</p>
  
  <p>When my example file contains "European" letters (Norwegian: å ø æ), then the following command tells me the file encoding is "iso-8859-1"</p>
  
  <pre><code>file -bi example.txt
  </code></pre>
  
  <p>However, when I take a copy of the same example file and modify it to contain different data, without any Norwegian text (let's say, I replace "Bjørn" with "Bjorn"), then the same command tells me the file encoding is "us-ascii".</p>
  
  <pre><code>file -bi example-no-european-letters.txt
  </code></pre>
  
  <p>What does this mean? Is ISO-8859-1 in practise the same as US-ASCII if there are no "European" characters in it?</p>
  
  <p>Should I just use a charset "ISO-8559-1" and everything will be ok?</p>