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.
This commit is contained in:
parent
654132cb9c
commit
08b1354b36
|
@ -1431,7 +1431,7 @@ void EditorExportPlatform::zip_folder_recursive(zipFile &p_zip, const String &p_
|
||||||
nullptr,
|
nullptr,
|
||||||
0,
|
0,
|
||||||
0x0314, // "version made by", 0x03 - Unix, 0x14 - ZIP specification version 2.0, required to store Unix file permissions
|
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);
|
String target = da->read_link(f);
|
||||||
zipWriteInFileInZip(p_zip, target.utf8().get_data(), target.utf8().size());
|
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,
|
nullptr,
|
||||||
0,
|
0,
|
||||||
0x0314, // "version made by", 0x03 - Unix, 0x14 - ZIP specification version 2.0, required to store Unix file permissions
|
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);
|
Ref<FileAccess> fa = FileAccess::open(dir.path_join(f), FileAccess::READ);
|
||||||
if (fa.is_null()) {
|
if (fa.is_null()) {
|
||||||
|
|
|
@ -72,7 +72,24 @@ Error ZIPPacker::start_file(const String &p_path) {
|
||||||
zipfi.internal_fa = 0;
|
zipfi.internal_fa = 0;
|
||||||
zipfi.external_fa = 0;
|
zipfi.external_fa = 0;
|
||||||
|
|
||||||
int err = zipOpenNewFileInZip(zf, p_path.utf8().get_data(), &zipfi, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
int err = zipOpenNewFileInZip4(zf,
|
||||||
|
p_path.utf8().get_data(),
|
||||||
|
&zipfi,
|
||||||
|
nullptr,
|
||||||
|
0,
|
||||||
|
nullptr,
|
||||||
|
0,
|
||||||
|
nullptr,
|
||||||
|
Z_DEFLATED,
|
||||||
|
Z_DEFAULT_COMPRESSION,
|
||||||
|
0,
|
||||||
|
-MAX_WBITS,
|
||||||
|
DEF_MEM_LEVEL,
|
||||||
|
Z_DEFAULT_STRATEGY,
|
||||||
|
nullptr,
|
||||||
|
0,
|
||||||
|
0x0314, // "version made by", 0x03 - Unix, 0x14 - ZIP specification version 2.0, required to store Unix file permissions.
|
||||||
|
1 << 11); // Bit 11 is the language encoding flag. When set, filename and comment fields must be encoded using UTF-8.
|
||||||
return err == ZIP_OK ? OK : FAILED;
|
return err == ZIP_OK ? OK : FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue