[docs] [issue27344] zipfile *does* support utf-8 filenames

Daniel Holth report at bugs.python.org
Thu Jun 23 11:46:24 EDT 2016

Daniel Holth added the comment:

The current documentation says "Note There is no official file name encoding for ZIP files. If you have unicode file names, you must convert them to byte strings in your desired encoding before passing them to write(). WinZip interprets all file names as encoded in CP437, also known as DOS Latin."

This is bad advice because if you convert the filenames to bytes before passing them to zipfile, it won't remember that they should be unicode. Instead it should say

"The ZIP file format supports Unicode filenames. If you have unicode filenames, zipfile will encode them to and from utf-8 internally. If you pass bytes filenames to write() then they will be stored without a specified encoding."

I am not sure what current versions of WinZip or Windows file manager do.


Python tracker <report at bugs.python.org>

More information about the docs mailing list