dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: php ZipArchive() - special characters not displayed correctly when listing filenames

  1. #1
    Join Date
    Nov 2008
    Posts
    7

    php ZipArchive() - special characters not displayed correctly when listing filenames

    I have tried EVERYTHING and asked the question on 3 different php forums but nobody could come up with a solution. I'm desperate !

    I have a FTP on a dedicated server where my users uploads mp3 in zip files. I use a php page to display the list of the filenames inside the archive.

    Problem is that when some of the mp3 filenames have accents (like ) then it is not displayed correctly even if the page is set to use UTF8.

    for exemple, "" will become " "
    "" will become " "
    "" will become " "

    Code:
    <?php
    header('Content-Type: text/html; charset=utf-8');
    
    setlocale(LC_ALL, 'fr_FR');
    
    echo "
    <html>
    <head>
    <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />
    </head>
    <body>";
    
    $downloadlink = "dl/pp/86 Crew - 2000 - Bad Bad Reggae.zip";
    $za = new ZipArchive();
    $za->open($downloadlink);
    for( $i = 0; $i < $za->numFiles; $i++ ){
    $stat = $za->statIndex( $i );
    $tounes = array( basename( $stat['name'] ) . PHP_EOL );
    foreach($tounes as $toune) {
    echo "$toune <br>";
    }
    }
    
    echo "</body></html>";
            ?>

  2. #2
    Join Date
    Aug 2015
    Posts
    1

    Question

    Have you ever solved this issue?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles