Zip archives are encoded in ISO-8859-1 when stored but comments seem to be added in UTF-8 everytime. So...
<?php
$zip->setArchiveComment("Peña"); $zip->setArchiveComment("Peña"); ?>
Using mb_internal_encoding() or mb_http_output() wont change this behavior.
At the end you can fix your corrupted comment using something like str_replace();
Consider this:
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip', ZipArchive::CREATE);
if ($res === TRUE) {
$zip->addFromString('test.txt', 'file content goes here');
$zip->setArchiveComment('Peña'); $zip->close();
$file = file_get_contents('test.zip');
file_put_contents('test.zip', str_replace("Peña", utf8_decode("Peña"), $file)); echo 'ok';
} else {
echo 'failed';
}
?>