title: Java zip character encoding
body: <p>I'm using the following method to compress a file into a zip file:</p>
  
  <pre><code>import java.util.zip.CRC32;
  import java.util.zip.ZipEntry;
  import java.util.zip.ZipOutputStream;
  
  public static void doZip(final File inputfis, final File outputfis) throws IOException {
  
      FileInputStream fis = null;
      FileOutputStream fos = null;
  
      final CRC32 crc = new CRC32();
      crc.reset();
  
      try {
          fis = new FileInputStream(inputfis);
          fos = new FileOutputStream(outputfis);
          final ZipOutputStream zos = new ZipOutputStream(fos);
          zos.setLevel(6);
          final ZipEntry ze = new ZipEntry(inputfis.getName());
          zos.putNextEntry(ze);
          final int BUFSIZ = 8192;
          final byte inbuf[] = new byte[BUFSIZ];
          int n;
          while ((n = fis.read(inbuf)) != -1) {
              zos.write(inbuf, 0, n);
              crc.update(inbuf);
          }
          ze.setCrc(crc.getValue());
          zos.finish();
          zos.close();
      } catch (final IOException e) {
          throw e;
      } finally {
          if (fis != null) {
              fis.close();
          }
          if (fos != null) {
              fos.close();
          }
      }
  }
  </code></pre>
  
  <p>My problem is that i have flat text files with the content <code>N°TICKET</code> for example, the zipped result gives some weired characters when uncompressed <code>NÂ° TICKET</code>.  Also characters such as <code>é</code> and <code>à</code> are not supported.</p>
  
  <p>I guess it's due to the character encoding, but I don't know how to set it in my zip method to <code>ISO-8859-1</code> ?</p>
  
  <p>(I'm running on windows 7, java 6)</p>