Set language encoding flag when using ZIPPacker

When non-ASCII filenames are used, this indicates that the encoding is
UTF-8. Programs like ZIPReader can then parse the filename correctly.

(cherry picked from commit 08b1354b36)
This commit is contained in:
Haoyu Qiu
2023-06-27 11:49:51 +08:00
committed by Rémi Verschelde
parent 6f8cc1b8de
commit 5db5f0b52b
2 changed files with 20 additions and 3 deletions

View File

@@ -1431,7 +1431,7 @@ void EditorExportPlatform::zip_folder_recursive(zipFile &p_zip, const String &p_
nullptr,
0,
0x0314, // "version made by", 0x03 - Unix, 0x14 - ZIP specification version 2.0, required to store Unix file permissions
0);
1 << 11); // Bit 11 is the language encoding flag. When set, filename and comment fields must be encoded using UTF-8.
String target = da->read_link(f);
zipWriteInFileInZip(p_zip, target.utf8().get_data(), target.utf8().size());
@@ -1475,7 +1475,7 @@ void EditorExportPlatform::zip_folder_recursive(zipFile &p_zip, const String &p_
nullptr,
0,
0x0314, // "version made by", 0x03 - Unix, 0x14 - ZIP specification version 2.0, required to store Unix file permissions
0);
1 << 11); // Bit 11 is the language encoding flag. When set, filename and comment fields must be encoded using UTF-8.
Ref<FileAccess> fa = FileAccess::open(dir.path_join(f), FileAccess::READ);
if (fa.is_null()) {