php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58666 Irregular UTF8 encoded filenames
Submitted: 2009-05-11 10:02 UTC Modified: 2015-05-05 14:34 UTC
Votes:9
Avg. Score:3.8 ± 1.3
Reproduced:7 of 7 (100.0%)
Same Version:1 (14.3%)
Same OS:1 (14.3%)
From: nescha at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: zip (PECL)
PHP Version: 5.2.9 OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nescha at gmail dot com
New email:
PHP Version: OS:

 

 [2009-05-11 10:02 UTC] nescha at gmail dot com
Description:
------------
If you create ZIP file with custom assigned UTF-8 filenames for compressed files, resulting ZIP won't save those filenames correctly.

Reproduce code:
---------------
<?php
	$files = array(
		'0.txt' => 'regular.txt',
		'1.txt' => '??????.txt',
		'2.txt' => '?&#273;?&#263;&#273;?.txt',
		'3.txt' => '&#1094;&#1080;&#1088;&#1080;&#1083;&#1080;&#1094;.txt'
	);

	$zip = new ZipArchive();
	$id = 'zipfile_' . time();
	$filename = "$id.zip";
	if ($zip->open($filename, ZIPARCHIVE::CREATE)) {
		foreach ($files as $src => $name) {
			$zip->addFile($src, $name);
		}
	}
	$zip->close();
	echo $id;
?>

Expected result:
----------------
You'll get name of the created ZIP file. If you open/download that ZIP file, all the files that are compressed should have proper filename.

Actual result:
--------------
Only name of the first file is interpreted correctly. All others, which are UTF-8 encoded, are renamed with some strange characters.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-11 10:05 UTC] nescha at gmail dot com
2.txt => Some characters from Serbian Latin language
3.txt => Some cyrillic characters

Nevertheless, even those Norwegian characters are garbled
 [2015-05-05 14:34 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2015-05-05 14:34 UTC] cmb@php.net
Apparently, this is the same issue as bug #65815. I'm marking this
one as duplicate even though it's older, because the other report
is more comprehensive.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 29 08:01:30 2024 UTC