Bug #53948 [NEW]: ZIP archive UTF-8 filenames problem

From: Date: Mon, 07 Feb 2011 13:06:40 +0000
Subject: Bug #53948 [NEW]: ZIP archive UTF-8 filenames problem
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-158546@lists.php.net to get a copy of this message
From:             
Operating system: linux
PHP version:      5.3.5
Package:          Zip Related
Bug Type:         Bug
Bug description:ZIP archive UTF-8 filenames problem

Description:
------------
when creating zip archive with non-english filenames, 
the filenames are not encoded correctly, upon extraction
you get them like ???_???.txt.
(tested with various unzipping software on windows/linux)

a suggested workaround, e.g:

$zip->addFile($file_data['path'],
iconv("UTF-8","CP852",$file_name));

doesn't help

Test script:
---------------
<?php

   $zip = new ZipArchive();

   if ($zip->open('/tmp/test.zip', ZIPARCHIVE::CREATE) === TRUE) {

      $zip->addFile('/tmp/file.txt', 'קובץ.txt');

      $zip->close();

      echo "done";

   } else {

      echo "failed";

   }

?>


Expected result:
----------------
create a zip file which can be extracted reproducing the original file
names.

Actual result:
--------------
non english file names comes out corrupted, e.g: ???_???.txt

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53948&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=53948&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=53948&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=53948&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=53948&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53948&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=53948&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=53948&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=53948&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=53948&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=53948&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=53948&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=53948&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=53948&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=53948&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53948&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53948&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=53948&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=53948&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=53948&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=53948&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=53948&r=mysqlcfg



Thread (17 messages)

« previous php.bugs (#158546) next »