Concerning [problems with UTF-8 and] downloading Zip files I found that simply adding 3 lines of code before starting the fread to the buffer for delivery in all browsers solved the problem.
<?php
ob_end_clean();
ob_start();
header( 'Content-Type:' );
?>
... see where placed in the function below:
<?php
function readfile_chunked( $filename, $retbytes = true ) {
$chunksize = 1 * (1024 * 1024); $buffer = '';
$cnt = 0;
$handle = fopen( $filename, 'rb' );
if ( $handle === false ) {
return false;
}
ob_end_clean(); ob_start(); header( 'Content-Type:' ); while ( !feof( $handle ) ) {
$buffer = fread( $handle, $chunksize );
echo $buffer;
ob_flush();
flush();
if ( $retbytes ) {
$cnt += strlen( $buffer );
}
}
$status = fclose( $handle );
if ( $retbytes && $status ) {
return $cnt; }
return $status;
}
?>