@@ -387,13 +387,6 @@ ZipFile Objects
387387 given.
388388 The archive must be open with mode ``'w' ``, ``'x' `` or ``'a' ``.
389389
390- .. note ::
391-
392- There is no official file name encoding for ZIP files. If you have unicode file
393- names, you must convert them to byte strings in your desired encoding before
394- passing them to :meth: `write `. WinZip interprets all file names as encoded in
395- CP437, also known as DOS Latin.
396-
397390 .. note ::
398391
399392 Archive names should be relative to the archive root, that is, they should not
@@ -413,7 +406,9 @@ ZipFile Objects
413406.. method :: ZipFile.writestr(zinfo_or_arcname, data, compress_type=None, \
414407 compresslevel=None)
415408
416- Write the string *data * to the archive; *zinfo_or_arcname * is either the file
409+ Write a file into the archive. The contents is *data *, which may be either
410+ a :class: `str ` or a :class: `bytes ` instance; if it is a :class: `str `,
411+ it is encoded as UTF-8 first. *zinfo_or_arcname * is either the file
417412 name it will be given in the archive, or a :class: `ZipInfo ` instance. If it's
418413 an instance, at least the filename, date, and time must be given. If it's a
419414 name, the date and time is set to the current date and time.
@@ -454,11 +449,11 @@ The following data attributes are also available:
454449
455450.. attribute :: ZipFile.comment
456451
457- The comment text associated with the ZIP file. If assigning a comment to a
452+ The comment associated with the ZIP file as a :class: `bytes ` object.
453+ If assigning a comment to a
458454 :class: `ZipFile ` instance created with mode ``'w' ``, ``'x' `` or ``'a' ``,
459- this should be a
460- string no longer than 65535 bytes. Comments longer than this will be
461- truncated in the written archive when :meth: `close ` is called.
455+ it should be no longer than 65535 bytes. Comments longer than this will be
456+ truncated.
462457
463458
464459.. _pyzipfile-objects :
@@ -625,13 +620,14 @@ Instances have the following methods and attributes:
625620
626621.. attribute :: ZipInfo.comment
627622
628- Comment for the individual archive member.
623+ Comment for the individual archive member as a :class: ` bytes ` object .
629624
630625
631626.. attribute :: ZipInfo.extra
632627
633628 Expansion field data. The `PKZIP Application Note `_ contains
634- some comments on the internal structure of the data contained in this string.
629+ some comments on the internal structure of the data contained in this
630+ :class: `bytes ` object.
635631
636632
637633.. attribute :: ZipInfo.create_system
0 commit comments