diff --git a/lib/classes/dataformat/base.php b/lib/classes/dataformat/base.php index d9fe32d..41aebe0 100644 --- a/lib/classes/dataformat/base.php +++ b/lib/classes/dataformat/base.php @@ -94,6 +94,9 @@ abstract class base { header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT'); header("Content-Type: $this->mimetype\n"); $filename = $this->filename . $this->get_extension(); + if (\core_useragent::is_ie() || \core_useragent::is_edge()) { + $filename = rawurlencode($filename); + } header("Content-Disposition: attachment; filename=\"$filename\""); } diff --git a/lib/classes/dataformat/spout_base.php b/lib/classes/dataformat/spout_base.php index 9208e60..ae294e1 100644 --- a/lib/classes/dataformat/spout_base.php +++ b/lib/classes/dataformat/spout_base.php @@ -53,7 +53,11 @@ abstract class spout_base extends \core\dataformat\base { $this->writer->setTempFolder(make_request_directory()); } $filename = $this->filename . $this->get_extension(); + if (\core_useragent::is_ie() || \core_useragent::is_edge()) { + $filename = rawurlencode($filename); + } $this->writer->openToBrowser($filename); + if ($this->sheettitle && $this->writer instanceof \Box\Spout\Writer\AbstractMultiSheetsWriter) { $sheet = $this->writer->getCurrentSheet(); $sheet->setName($this->sheettitle); diff --git a/lib/csvlib.class.php b/lib/csvlib.class.php index 1ecb160..0cfa0f9 100644 --- a/lib/csvlib.class.php +++ b/lib/csvlib.class.php @@ -498,6 +498,9 @@ class csv_export_writer { } header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT'); header("Content-Type: $this->mimetype\n"); + if (core_useragent::is_ie() || core_useragent::is_edge()) { + $filename = rawurlencode($filename); + } header("Content-Disposition: attachment; filename=\"$this->filename\""); } diff --git a/lib/excellib.class.php b/lib/excellib.class.php index ff38252..ef612b4 100644 --- a/lib/excellib.class.php +++ b/lib/excellib.class.php @@ -116,7 +116,7 @@ class MoodleExcelWorkbook { header('Pragma: no-cache'); } - if (core_useragent::is_ie()) { + if (core_useragent::is_ie() || core_useragent::is_edge()) { $filename = rawurlencode($filename); } else { $filename = s($filename); diff --git a/lib/filelib.php b/lib/filelib.php index 0c9f70f..91916b8 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -2033,7 +2033,7 @@ function send_temp_file($path, $filename, $pathisstring=false) { } // if user is using IE, urlencode the filename so that multibyte file name will show up correctly on popup - if (core_useragent::is_ie()) { + if (core_useragent::is_ie() || core_useragent::is_edge()) { $filename = urlencode($filename); } @@ -2107,7 +2107,7 @@ function send_file($path, $filename, $lifetime = null , $filter=0, $pathisstring } // if user is using IE, urlencode the filename so that multibyte file name will show up correctly on popup - if (core_useragent::is_ie()) { + if (core_useragent::is_ie() || core_useragent::is_edge()) { $filename = rawurlencode($filename); } @@ -2287,7 +2287,7 @@ function send_stored_file($stored_file, $lifetime=null, $filter=0, $forcedownloa } // if user is using IE, urlencode the filename so that multibyte file name will show up correctly on popup - if (core_useragent::is_ie()) { + if (core_useragent::is_ie() || core_useragent::is_edge()) { $filename = rawurlencode($filename); } diff --git a/mod/feedback/export.php b/mod/feedback/export.php index 6f66728..4f5fa19 100644 --- a/mod/feedback/export.php +++ b/mod/feedback/export.php @@ -165,6 +165,9 @@ function feedback_get_xml_data($feedbackid) { } function feedback_send_xml_data($data, $filename) { + if (core_useragent::is_ie() || core_useragent::is_edge()) { + $filename = rawurlencode($filename); + } @header('Content-Type: application/xml; charset=UTF-8'); @header('Content-Disposition: attachment; filename="'.$filename.'"'); print($data);