You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2009/02/18 13:12:55 UTC
svn commit: r745488 - in
/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers:
jar/JarArchiveOutputStream.java zip/ZipArchiveOutputStream.java
zip/ZipFile.java
Author: bodewig
Date: Wed Feb 18 12:12:54 2009
New Revision: 745488
URL: http://svn.apache.org/viewvc?rev=745488&view=rev
Log:
make ZipArchiveOutputStream and ZipFile use UTF-8 by default
Modified:
commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java
commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java?rev=745488&r1=745487&r2=745488&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java (original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java Wed Feb 18 12:12:54 2009
@@ -29,7 +29,6 @@
public JarArchiveOutputStream( final OutputStream out ) {
super(out);
- setEncoding("UTF8");
}
public void putArchiveEntry(ArchiveEntry entry) throws IOException {
Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java?rev=745488&r1=745487&r2=745488&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java (original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java Wed Feb 18 12:12:54 2009
@@ -94,6 +94,11 @@
public static final int STORED = java.util.zip.ZipEntry.STORED;
/**
+ * default encoding for file names and comment.
+ */
+ static final String DEFAULT_ENCODING = "UTF8";
+
+ /**
* Current entry.
*
* @since 1.1
@@ -205,11 +210,11 @@
*
* <p>For a list of possible values see <a
* href="http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html">http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html</a>.
- * Defaults to the platform's default character encoding.</p>
+ * Defaults to UTF-8.</p>
*
* @since 1.3
*/
- private String encoding = null;
+ private String encoding = DEFAULT_ENCODING;
// CheckStyle:VisibilityModifier OFF - bc
@@ -302,8 +307,9 @@
*
* <p>For a list of possible values see <a
* href="http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html">http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html</a>.
- * Defaults to the platform's default character encoding.</p>
- * @param encoding the encoding value
+ * Defaults to UTF-8.</p>
+ * @param encoding the encoding to use for file names, use null
+ * for the platform's default encoding
* @since 1.3
*/
public void setEncoding(String encoding) {
Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java?rev=745488&r1=745487&r2=745488&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java (original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java Wed Feb 18 12:12:54 2009
@@ -91,9 +91,9 @@
*
* <p>For a list of possible values see <a
* href="http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html">http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html</a>.
- * Defaults to the platform's default character encoding.</p>
+ * Defaults to UTF-8.</p>
*/
- private String encoding = null;
+ private final String encoding;
/**
* The actual data source.
@@ -101,27 +101,25 @@
private RandomAccessFile archive;
/**
- * Opens the given file for reading, assuming the platform's
- * native encoding for file names.
+ * Opens the given file for reading, assuming "UTF8" for file names.
*
* @param f the archive.
*
* @throws IOException if an error occurs while reading the file.
*/
public ZipFile(File f) throws IOException {
- this(f, null);
+ this(f, ZipArchiveOutputStream.DEFAULT_ENCODING);
}
/**
- * Opens the given file for reading, assuming the platform's
- * native encoding for file names.
+ * Opens the given file for reading, assuming "UTF8".
*
* @param name name of the archive.
*
* @throws IOException if an error occurs while reading the file.
*/
public ZipFile(String name) throws IOException {
- this(new File(name), null);
+ this(new File(name), ZipArchiveOutputStream.DEFAULT_ENCODING);
}
/**
@@ -129,7 +127,8 @@
* encoding for file names.
*
* @param name name of the archive.
- * @param encoding the encoding to use for file names
+ * @param encoding the encoding to use for file names, use null
+ * for the platform's default encoding
*
* @throws IOException if an error occurs while reading the file.
*/
@@ -142,7 +141,8 @@
* encoding for file names.
*
* @param f the archive.
- * @param encoding the encoding to use for file names
+ * @param encoding the encoding to use for file names, use null
+ * for the platform's default encoding
*
* @throws IOException if an error occurs while reading the file.
*/