diff --git a/lib/util/ktpclzip.inc.php b/lib/util/ktpclzip.inc.php index b173109..9faf3e7 100644 --- a/lib/util/ktpclzip.inc.php +++ b/lib/util/ktpclzip.inc.php @@ -128,7 +128,9 @@ class KTPclZip { $excludePath = $this->getExcludePath($sFolder, DIRECTORY_SEPARATOR); // Create the zip archive using the PclZip Wrapper - if ($this->_pclZip->create ( $sFolder , PCLZIP_OPT_REMOVE_PATH, $excludePath) == 0) { + if ($this->_pclZip->create ( $sFolder , + PCLZIP_OPT_REMOVE_PATH, $excludePath, + PCLZIP_CB_PRE_ADD, 'convertFilenameEncoding_Add') == 0) { //( File_Archive::read ( $this->sTmpPath . '/Root Folder' ), File_Archive::toArchive ( $this->sZipFileName . '.' . $this->extension, File_Archive::toFiles ( $this->sTmpPath ), $this->extension ) ); return PEAR::raiseError ( _kt ( "Error compressing files" ) ); } @@ -193,7 +195,8 @@ class KTPclZip { } */ - if ($this->_pclZip->extract ( PCLZIP_OPT_PATH, $this->sTmpPath ) == 0) { + if ($this->_pclZip->extract ( PCLZIP_OPT_PATH, $this->sTmpPath, + PCLZIP_CB_PRE_EXTRACT, 'convertFilenameEncoding_Extract' ) == 0) { return PEAR::raiseError ( _kt ( "Error : Unable to unzip archive" ) ); } @@ -515,7 +518,19 @@ class KTPclZip { return false; } */ - - } + +function convertFilenameEncoding_Extract($p_event, &$p_header) +{ + $p_header['filename'] = iconv("CP437", "UTF-8", $p_header['filename']); + return 1; +} + +function convertFilenameEncoding_Add($p_event, &$p_header) +{ + $p_header['stored_filename'] = iconv("UTF-8", "CP437", $p_header['stored_filename']); + return 1; + +} + ?>