Skip to content

Commit

Permalink
ZIP: Improve encoding detection by only feeding the filename to ICU
Browse files Browse the repository at this point in the history
Before the string contained full paths, breaking the detection logic because most paths are ASCII
  • Loading branch information
Ghabry committed Oct 9, 2024
1 parent 60c998f commit 981ac0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/filesystem_zip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ ZipFilesystem::ZipFilesystem(std::string base_path, FilesystemView parent_fs, St
int items = 0;
while (ReadCentralDirectoryEntry(zip_is, filepath, entry, is_utf8)) {
// Only consider Non-ASCII & Non-UTF8 for encoding detection
// Skip directories, files already contain the paths
if (is_utf8 || filepath.back() == '/' || Utils::StringIsAscii(filepath)) {
// Directories are skipped as most of them are usually ASCII and do not help with the detection
if (is_utf8 || filepath.back() == '/' || Utils::StringIsAscii(std::get<1>(FileFinder::GetPathAndFilename(filepath)))) {
continue;
}
// Codepath will be only entered by Windows "compressed folder" ZIPs (uses local encoding) and
Expand Down

0 comments on commit 981ac0f

Please sign in to comment.