From: Michihiro NAKAJIMA Date: Tue, 12 Apr 2011 13:32:57 +0000 (-0400) Subject: Allow to apply the charset specified by the hdrcharset option to PAX reader only... X-Git-Tag: v3.0.0a~469 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a01fb24b3b1cb32bf1ff44d2a75d3b429008b193;p=thirdparty%2Flibarchive.git Allow to apply the charset specified by the hdrcharset option to PAX reader only when 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 --- diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index f187a5af7..ebc79df0b 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -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);