Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It looks like as soon as you want to use non-ASCII characters in your suggested filename things get a bit crazy. Perhaps our code should implement the approach suggested in this article:
http://stackoverflow.com/questions/93551/how-to-encode-the-filename-para...
Namely:
$filename = $_GET['file']; //this string is already decoded
if (strstr($_SERVER['HTTP_USER_AGENT'],"MSIE"))
$filename = rawurlencode($filename);
header('Content-Disposition: attachment; filename="'.$filename.'"');