[
https://issues.apache.org/jira/browse/TIKA-4752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18086396#comment-18086396
]
ASF GitHub Bot commented on TIKA-4752:
--------------------------------------
Copilot commented on code in PR #2871:
URL: https://github.com/apache/tika/pull/2871#discussion_r3363492001
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pkg-module/src/main/java/org/apache/tika/parser/pkg/ZipParser.java:
##########
@@ -549,22 +550,37 @@ private void parseStreamEntry(ZipArchiveInputStream zis,
ZipArchiveEntry entry,
}
}
- private String detectEntryName(ZipArchiveEntry entry, Metadata
parentMetadata,
- ParseContext context, ZipParserConfig
config) throws IOException {
+ private String detectEntryName(ZipArchiveEntry entry, ParseContext context,
+ ZipParserConfig config) throws IOException
{
// If user specified an encoding, decode raw bytes with that charset
// This avoids needing to reopen the ZipFile with a different charset
if (config.getEntryEncoding() != null) {
return new String(entry.getRawName(), config.getEntryEncoding());
}
+ // A zip only ever declares a name as UTF-8 (it can't name a legacy
charset),
+ // two ways. The Unicode extra field carries a CRC-validated UTF-8
name
> Use the utf8 flag in charset detection for zip file names
> ---------------------------------------------------------
>
> Key: TIKA-4752
> URL: https://issues.apache.org/jira/browse/TIKA-4752
> Project: Tika
> Issue Type: Task
> Reporter: Tim Allison
> Priority: Trivial
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)