1

actually i've a problem with my zip code...

    <?php
     $zip = new ZipArchive();
     $ret = $zip->open('archive.zip', ZipArchive::OVERWRITE);
     if ($ret !== TRUE) {
       printf("Fail to open the archive %d", $ret);
    } else {
       $directory = realpath('../arch');
       $options = array('add_path' => 'sources/', 'remove_path' => $directory);
       $zip->addPattern('/\.(txt|evn)$/', $directory, $options);
       printf("Click <a href=\"archive.zip\">here</a> to download");
       $zip->close();
     }
     ?>

It's actually working, but i have some characters like "é" on some files (it's necessary, i can't modify), and when i download the archive, every "é" become "Ú". So, any solution ? It's not like this topic : Here I'm not using the addFile option but addPattern

  • 1
    Possible duplicate of [What encoding does ZipArchive use to store file names inside the created archive?](https://stackoverflow.com/questions/5005221/what-encoding-does-ziparchive-use-to-store-file-names-inside-the-created-archive) – CBroe Jun 06 '17 at 08:36
  • did you try this solutions:https://stackoverflow.com/questions/5005221/what-encoding-does-ziparchive-use-to-store-file-names-inside-the-created-archive – lalithkumar Jun 06 '17 at 08:40
  • Currently, the proposed solution is intended for the "addFile", but i use "addPattern", is it the same method ? – SuperSuperMel Jun 06 '17 at 08:40
  • you can check http://php.net/manual/en/ziparchive.addfile.php and http://php.net/manual/en/ziparchive.addpattern.php – lalithkumar Jun 06 '17 at 08:44
  • Yes lalithkumar, i'm using the second actually, but the problem is about the encoding of the characters – SuperSuperMel Jun 06 '17 at 09:45

0 Answers0