Bug #71034 [NEW]: Can't add UTF-8 filenames as UTF-8 to ZIP archive

From: Date: Fri, 04 Dec 2015 21:36:17 +0000
Subject: Bug #71034 [NEW]: Can't add UTF-8 filenames as UTF-8 to ZIP archive
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197599@lists.php.net to get a copy of this message
From:             slavikca at gmail dot com
Operating system: Ubuntu 14.04
PHP version:      5.6.16
Package:          Zip Related
Bug Type:         Bug
Bug description:Can't add UTF-8 filenames as UTF-8 to ZIP archive

Description:
------------
*Steps to reproduce*
- use ZipArchive to archive file, which has UTF-8 characters in it.


Test script:
---------------
<?php
$zip = new ZipArchive();
if ($zip->open("test.zip", ZIPARCHIVE::CREATE) !== true)
    die ("Failed to create archive");

if (!$zip->addFile("/var/www/test/web/тест123")) //here are UTF-8
characters in the filename
    print ("Failure adding file");

$zip->close();

Expected result:
----------------
the name of archived file will be stored as UTF-8

Actual result:
--------------
file successfully archived. But it's names stored not in UTF-8.

To see, if filename was stored au UTF-8 or not, you can use "-U" option
in unzip utility:

Here is output for archive created in PHP:
# unzip -l -U test.zip
...
   /var/www/test/web/тест123

Here is output for archive created by linux zip utility:
# unzip -l -U test2.zip
...
   /var/www/test/web/#U0442#U0435#U0441#U0442123

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



Thread (11 messages)

« previous php.bugs (#197599) next »