| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2008-11-01 17:31 UTC] mkurpel at gmail dot com
 Description:
------------
I am reading a ZIP file containing one XLS file named "??軾???????????????? ??ȫ?????????????????.xls". However, I am getting mangled characters from the zip_entry_name() function. I am working in UTF-8 so I utf_8_encoded it prior to echoing. All my php files are saved in utf-8 too.
Non-national characters are returned just fine.
Reproduce code:
---------------
header('Content-Type: text/html; charset: utf-8');
setlocale(LC_ALL, 'sk_SK.utf8');
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
$zip = zip_open(realpath($somezipfile));
while ($zip_entry = @zip_read($zip))
{
	echo $path = utf8_encode(zip_entry_name($zip_entry));
}
@zip_close($zip);
Expected result:
----------------
should echo this string: ??軾???????????????? ??ȫ?????????????????.xls
Actual result:
--------------
echoed this string: –?Ÿœ?ì ¡‚£“å„¢Ø??’”‰ •欛¦?µ???ÕŽà·Ò?‘™?š.xls
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 13:00:02 2025 UTC | 
I tried the same script as pajoye sent here. Only added a second line with original filename for comparison: <?php $somezipfile = '46456.zip'; $zip = zip_open(realpath($somezipfile)); while ($zip_entry = zip_read($zip)) { echo zip_entry_name($zip_entry); } zip_close($zip); ?> <br> ľ?čť???????ň??ěďřĺ??? Ľ?ČŤ???????Ň??ĚĎŘĹ???.xls Be sure to save it as ANSI (so we are not messing with utf-8 now). What it outputs is: http://obrazok.eu/files/79gro4t39dzzzr3mk6u7.png The strings should be the same. I do not think what it outputs is okay.