From 456fe586d7b1421d122db419577195e90d207371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 19 Feb 2016 17:04:23 +0100 Subject: [PATCH] In case the filename contains non ASCII characters then follow rfc6266. fix #253 This will fix the downloaded filename with Edge, IE11 if it contains a non ASCII character. --- resources/php-epub-meta/tbszip.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/php-epub-meta/tbszip.php b/resources/php-epub-meta/tbszip.php index 37db5ae..ab75a44 100644 --- a/resources/php-epub-meta/tbszip.php +++ b/resources/php-epub-meta/tbszip.php @@ -645,7 +645,11 @@ class clsTbsZip { } else { header ('Pragma: no-cache'); if ($ContentType!='') header ('Content-Type: '.$ContentType); - header('Content-Disposition: attachment; filename="'.$File.'"'); + if (strlen($File) != strlen(utf8_decode($File))) { + header('Content-Disposition: attachment; filename="book.epub"; filename*=utf-8\'\'' . rawurlencode($File)); + } else { + header('Content-Disposition: attachment; filename="'.$File.'"'); + } header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: public');