The "Export Project as ZIP" feature generates a ZIP file in which characters are corrupted

The Chinese characters in file or folder names become garbled, while exporting the same names in Godot works fine without any issues.

And I asked an AI and received the following response:

I also consulted an AI, which provided the following explanation:

After further inquiry with AI, I obtained a Python script to solve this problem

import zipfile

# =======================
# Set input ZIP file path and output ZIP file path
# =======================
input_zip_path = r"C:\Users\Administrator\Documents\ActionGameMaker\backup.zip"   # Original AGM ZIP file
output_zip_path = r"C:\Users\Administrator\Documents\ActionGameMaker\fixed.zip"  # Output ZIP file after repair

with zipfile.ZipFile(input_zip_path, 'r') as original_zip:
    with zipfile.ZipFile(output_zip_path, 'w', zipfile.ZIP_DEFLATED, allowZip64=True) as new_zip:
        for info in original_zip.infolist():
            # Read original file data
            data = original_zip.read(info.filename)
            # Fix filename using UTF-8
            try:
                fixed_filename = info.filename.encode('cp437').decode('utf-8')
            except Exception as e:
                fixed_filename = info.filename  # Keep original name if conversion fails
                print(f"Conversion failed: {info.filename}, {e}")
            # Write to new ZIP with UTF-8 filename
            info_utf8 = zipfile.ZipInfo(fixed_filename)
            info_utf8.external_attr = info.external_attr
            new_zip.writestr(info_utf8, data)
2 Likes