php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71509 Zip problem with swedish letters in filename.
Submitted: 2016-02-03 12:56 UTC Modified: 2016-08-08 10:02 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: nikolas dot engstrom at marvaco dot se Assigned: ab (profile)
Status: Closed Package: zip (PECL)
PHP Version: 7.0.2 OS: windows 7
Private report: No CVE-ID: None
 [2016-02-03 12:56 UTC] nikolas dot engstrom at marvaco dot se
Description:
------------
When using filenames with special Swedish letters for example "Röd_Statistics.pdf". It's not possible to add files into a zip archive file.

Test script:
---------------
<?PHP
// åöä
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);

$testfile = "C:\\Users\\nikolasengstrom\\Desktop\\Röd_Statistics.pdf";
$outputfile = "C:\\Users\\nikolasengstrom\\Desktop\\Testing1.zip";

$zipfile = new ZipArchive;
$return_code = $zipfile->open($outputfile, ZipArchive::CREATE);
if ($return_code != true) die("Failed to open file: " . $return_code);

$testfile_zip = mb_convert_encoding($testfile, "ISO-8859-1", "UTF-8");
$return_code = $zipfile->addfile($testfile_zip, substr($testfile, (strrpos($testfile, "\\") + 1)));
if ($return_code != true) print("Failed to add file: " . $zipfile->getStatusString());
		
$return_code = $zipfile->close();
if ($return_code != true) die("Failed to close archive: " . $zipfile->getStatusString());
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-05-19 04:34 UTC] yasuhiro dot oguro dot 7 at gmail dot com
I saw load entry from zip in CentOS.
I think that, ZipArchive library cant use MultiByte String without UTF-8.
 [2016-08-08 10:02 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2016-08-08 10:02 UTC] ab@php.net
Fixed in PHP 7.1, please read UPGRADING and use UTF-8.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 24 03:01:28 2024 UTC