PHP ZipArchive dont support UTF8 files for open
my problem is OPEN files with UTF8 name. ZipArchive dont open files with UTF8 character. i dont add new file i need only open file.
php: 5.6 and Use Yii2.
code:
$path = "files/تست تست.zip";
$zip = new \ZipArchive();
if($zip->open($path) === true) {
return "File opened";
}
else
{
return "File could not be opened";
}
Sorry about marking this as a duplicate for an unrelated issue.
I'm able to open UTF-8 zip files without a problem using PHP 5.6.
This code will create a new ZIP file with that filename without a problem, with a "test.txt" file in it:
This code will open an existing ZIP file with that name and print out the first filename from within the archive:
These examples work fine in the PHP Sandbox and on phptester.com (no direct link available). I tried it on 3v4l.org as well, but they don't have the php-zip extension enabled so
ZipArchive
is not available there.