What encoding does ZipArchive use to store file names in the created archive?

I am using the php class ZipArchive to create a zip archive. I use the second parameter of the addFile method to set the file name in the archive (since the real file on disk has a different name). Some names must contain French accents (e.g. & eacute;). When I download the archive, accents are not displayed correctly in the file name. What encoding should be used for file names? (application uses UTF-8)

+6
php encoding ziparchive
source share
3 answers

This is php # 53948 error, see official bug report .

Suggested workaround (worked for me):

$zip->addFile($file, iconv("UTF-8", "CP852", $local_name)); 
+9
source share

Use DOS encoding. My file names have Cyrillic characters, so I encode file names from cp1251 (Windows) to cp866 (DOS), passing the file name $zip->addFile() .

+4
source share

Zip files do not have the specified encoding; the archive tool should guess (or guess) the encoding used. First try CP1252, then from there.

+2
source share

All Articles