title: Creating tar archive with national characters in Java
body: <p>Do you know some library/way in Java to generate tar archive with file names in proper windows national codepage ( for example cp1250 ).</p>
  <p>I tried with <a href="http://www.trustice.com/java/tar/" rel="nofollow noreferrer">Java tar</a>, example code:</p>
  <pre><code>final TarEntry entry = new TarEntry( files[i] );
  String filename = files[i].getPath().replaceAll( baseDir, &quot;&quot; );
  entry.setName( new String( filename.getBytes(), &quot;Cp1250&quot; ) );
  out.putNextEntry( entry );
  ...
  </code></pre>
  <p>It doesn't work. National characters are broken where I extract tar in windows.
  I've also found a strange thing, under Linux Polish national characters are shown correctly only when I used ISO-8859-1:</p>
  <pre><code>entry.setName( new String( filename.getBytes(), &quot;ISO-8859-1&quot; ) );
  </code></pre>
  <p>Despite the fact that proper Polish codepage is ISO-8859-2, which doesn't work too.
  I've also tried Cp852 for windows, no effect.</p>
  <p>I know the limitations of tar format, but changing it is not an option.</p>
  <p>Thanks for suggestions,</p>