我对UNIX系统采用PHP 5.3.10与邮编版本1.12.5和Libzip版本0.11.2创建ZIP档案口音字符:PHP ZipArchive文件名中使用
<?php
$zip = new ZipArchive();
$test_zip = "./test.zip";
if ($zip->open($test_zip, ZIPARCHIVE::CREATE)===TRUE)
{
$zip->addFromString("Liste client à exporter.txt","Content line 1\nContent line 2\n");
$zip->close();
if(file_exists($test_zip))
{
header ("Content-Type: application/octet-stream");
header ("Accept-Ranges: bytes");
header ("Content-Length: ".filesize($test_zip));
header ("Content-Disposition: attachment; filename=\"test.zip\"");
header ("Cache-Control: max-age=60");
readfile($test_zip);
unlink ($test_zip);
}
}
?>
,当我打开生成的ZIP文件test.zip上Windows 7使用内部ZIP,我看到文件中的文件,如“Liste客户端+ exporter.txt”而不是“Liste客户端àexporter.txt”。 但是,如果用7z打开它,文件名是正确的,并带有口音。 PHP文件具有UTF-8编码。
解决 问题已在Windows 7(补丁KB2704299)
File names are corrupted after you decompress a .zip file in Windows 7 or in Windows Server 2008 R2
zip文件以解密的形式打开? – RaMeSh
不明白你的意思。下载后自动打开。双击zip文件时效果相同。 –
什么是确切的问题 – RaMeSh