$NetBSD: patch-ai,v 1.3 2018/04/30 07:56:55 taca Exp $

* Fix encoding problem of attached filenames; convert to Shift_JIS when
  using Internet Explore in Japanese environment, sigh.

--- functions/mime.php.orig	2018-01-16 23:36:07.000000000 +0000
+++ functions/mime.php
@@ -2589,6 +2589,10 @@ function SendDownloadHeaders($type0, $ty
     //set all the Cache Control Headers for IE
     if ($isIE) {
         $filename=rawurlencode($filename);
+        if ($squirrelmail_language == 'ja_JP') {
+            $filename = rawurldecode($filename);
+            $filename = mb_convert_encoding($filename, 'SJIS', 'AUTO');
+        }
         header ("Pragma: public");
         header ("Cache-Control: no-store, max-age=0, no-cache, must-revalidate"); // HTTP/1.1
         // does nothing - see: https://blogs.msdn.microsoft.com/ieinternals/2009/07/20/internet-explorers-cache-control-extensions/
