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';
}
?>