|  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
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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: nescha at gmail dot com
New email:
PHP Version: OS:


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

Reproduce code:
	$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 = "$";
	if ($zip->open($filename, ZIPARCHIVE::CREATE)) {
		foreach ($files as $src => $name) {
			$zip->addFile($src, $name);
	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.


Add a Patch

Pull Requests

Add a Pull Request


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]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2015-05-05 14:34 UTC]
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-2023 The PHP Group
All rights reserved.
Last updated: Mon May 29 23:03:39 2023 UTC