Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.1.2

Bug #6757 try to unpack files with some umlaut
Submitted: 2006-02-12 10:42 UTC
From: j dot mueller at department-x dot de Assigned:
Status: Suspended Package: Archive_Zip (version 0.1.1)
PHP Version: 5.1.2 OS: WinXP
Roadmaps: (Not assigned)    
Subscription  


 [2006-02-12 10:42 UTC] j dot mueller at department-x dot de
Description: ------------ if i try to unpack zipfiles where filenames inside have some umlaut ... Test script: --------------- if (isset($_GET['do']) && 'upload' == $_GET['do'] && isset($_FILES['galleryzip'])) { if (isset($_FILES['galleryzip']['name'])) { $_FILES['galleryzip']['name'] = preg_replace("#([a-zA-Z0-9]+)#", "\\1", $_FILES['galleryzip']['name']); } if(move_uploaded_file($_FILES['galleryzip']['tmp_name'], ZIP.$_FILES['galleryzip']['name'])) { $objZIP =& new Archive_Zip(ZIP.$_FILES['galleryzip']['name']); $objZIP->extract(0); $dirname = str_replace('.zip', '', $_FILES['galleryzip']['name']); $objIMG->createThumb(ROOT.$dirname); unlink(ZIP.$_FILES['galleryzip']['name']); } else { trigger_error('verschieben der Datei fehlgeschlagen'); } } Expected result: ---------------- filenames with umlaut will not be create now i have added 2 membervars in Archiv_zip /** * @var array search */ var $_search_array; /** * @var array replace */ var $_replace_array; inside of the constructor // ----- Set search and Replace Arrays $this->_search_array = array( "”","", "„","á", " " ); $this->_replace_array = array( "oe","ue", "ae", "ss", "_" ); // in function _readCentralFileHeader after Get filename $p_header['filename'] = str_replace($this->_search_array, $this->_replace_array, $p_header['filename']); // in function _readFileHeader before Set the stored filename $p_header['filename'] = str_replace($this->_search_array, $this->_replace_array, $p_header['filename']);

Comments

 [2006-06-15 13:30 UTC] treeble at free dot fr (JCA)
I have found some problems with accent and other caracter like that(ô, û, ï, ë ...) I have corrected this problem with this two arrays : $this->_search_array = array("Š", "‚", "ˆ", "‰", "‹", "Œ", "“", "”", "…", "–", " "); $this->_replace_array = array("e", "e", "e", "e", "i" , "i", "o", "o", "a", "u", "_"); Sorry for my poor english
 [2006-06-15 13:37 UTC] treeble at free dot fr (JCA)
OK, ythe caracter can't be post correctly, so you just have to test with a filename with grave accent and other special caracter. You take the caracters who are posted (listContent() => print_r => filename), and you just have to put them in the search_array, and in the replace_array you have to give the equivalent caracter without dieresis, accent or circumflexe ...
 [2006-10-01 19:29 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!