OSDN Git Service

BugTrack-wiki/351 : Edgeブラウザーにおけるダウンロードファイル名の文字化け対応
authorkgsoft <kgsoft@users.osdn.me>
Tue, 17 Apr 2018 09:55:33 +0000 (09:55 +0000)
committerkgsoft <kgsoft@users.osdn.me>
Tue, 17 Apr 2018 09:55:33 +0000 (09:55 +0000)
lib/Util.pm

index e7f8f0f..43a78c6 100644 (file)
@@ -723,7 +723,7 @@ sub make_content_disposition {
        my ($filename, $disposition) = @_;
        my $ua = $ENV{"HTTP_USER_AGENT"};
        eval("use MIME::Base64;");
-       my $encoded = ( $ua =~ /MSIE|Trident/i   ? Jcode->new($filename)->sjis
+       my $encoded = ( $ua =~ /MSIE|Trident|Edge/i ? Jcode->new($filename)->sjis
                      : $ua =~ /Chrome|Firefox/i ? "=?utf-8?B?".MIME::Base64::encode_base64(Jcode->new($filename)->utf8,'')."?="
                      : Jcode->new($filename)->utf8 );
        return "Content-Disposition: $disposition;filename=\"".$encoded."\"\n\n";