精灵 ZIP 里的中文文件名乱码?先查成员名编码
在 Python 3.11+ 只读列表中验证 ZIP 成员名编码和 UTF-8 标记,分清名字乱码与图片损坏。


美术交付的精灵 ZIP 解包后中文名乱码,但图片缩略图正常。先检查 ZIP 成员名的解码方式。这项检查适用于用 Python 3.11 或更新版本读取已有归档。
先列名字,暂不解包
同一份已知来源的 ZIP 先用 ZipFile(path, 'r') 打开,打印 namelist()。若交付方确认旧归档名使用 GBK,再用 ZipFile(path, 'r', metadata_encoding='gbk') 重新打开并列名。可以用 infolist() 查看成员 flag_bits 的第 11 位。该位表示按 UTF-8 解释名字,优先于 metadata_encoding。
把两种故障分开
若改用正确的旧编码后名字恢复,而同一成员仍能正常打开,问题在成员名元数据。若图片内容也打不开,再单独排查归档数据或图片格式。最稳妥的交付方式是向源头要一份名称验证通过的新 ZIP;引用名称的图集清单也要一起校对。制作新的对照样本可从精灵切图工具开始。
推荐使用本站工具

Automatic Sprite Slicing and ZIP Export: A Faster Way to Prepare 2D Game Assets
Learn how automatic sprite slicing and one-click ZIP export can help indie game developers turn character sheets, icon collections, and AI-generated 2D artwork into organized PNG assets faster.

From AI Sprite Cutter to Sprite Sheet Maker: A Complete 2D Asset Workflow
A practical workflow guide for turning raw 2D images into sliced PNG files, downloading them as a ZIP package, and using those files to create sprite sheets for Unity, Cocos, Godot, and custom game engines.

AI Sprite Cutter: How Indie Game Developers Can Split 2D Game Assets Faster
A practical guide for indie game developers, 2D artists, and prototype teams. Learn how an AI sprite cutter can split character sheets, UI icons, white-background assets, and AI-generated artwork into clean PNG files for Unity, Cocos, Godot, and sprite sheet workflows.
