]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Allow to apply the charset specified by the hdrcharset option to PAX reader only...
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Tue, 12 Apr 2011 13:32:57 +0000 (09:32 -0400)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Tue, 12 Apr 2011 13:32:57 +0000 (09:32 -0400)
the the charset described in PAX attribute is BINARY because BINARY means
the the character-set of a bunch of metadata(filname/uname/gname) is unknown.
It might be useful users can specify charset for 'BINARY' metadata, the users
may know a proper charset or try to find what kind of charset correctly convert.

SVN-Revision: 3217

libarchive/archive_read_support_format_tar.c

index f187a5af7c41e0b2eee719b91ada7716e8e4fa47..ebc79df0bd44c2bfc4a88911adaf2e76343f10c3 100644 (file)
@@ -1479,11 +1479,16 @@ pax_header(struct archive_read *a, struct tar *tar,
        }
 
        /*
-        * PAX format uses UTF-8 as default charset for its header metadata
-        * unless hdrcharset=BINARY is present.
+        * PAX format uses UTF-8 as default charset for its metadata
+        * unless hdrcharset=BINARY is present in its header.
+        * We apply the charset specified by the hdrcharset option only
+        * when the hdrcharset attribute(in PAX header) is BINARY because
+        * we respect the charset described in PAX header and BINARY also
+        * means that metadata(filename,uname and gname) character-set
+        * is unknown.
         */
        if (tar->pax_hdrcharset_binary)
-               sconv = NULL;
+               sconv = tar->opt_sconv;
        else {
                sconv = archive_string_conversion_from_charset(
                    &(a->archive), "UTF-8", 1);