Project

General

Profile

Actions

Defect #21656

closed

Fix Non ASCII attachment filename encoding broken (MOJIBAKE) in Microsoft Edge Explorer

Added by Hang Xie over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Category:
Attachments
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Microsoft Edge Explorer Change its User-Agent to this:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586

It makes redmine can not detect correctly, and it is easy to fix:
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 98a2246..1fae635 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -595,7 +595,7 @@ class ApplicationController < ActionController::Base

   # Returns a string that can be used as filename value in Content-Disposition header
   def filename_for_content_disposition(name)
-    request.env['HTTP_USER_AGENT'] =~ %r{(MSIE|Trident)} ? ERB::Util.url_encode(name) : name
+    request.env['HTTP_USER_AGENT'] =~ %r{(MSIE|Trident|Edge)} ? ERB::Util.url_encode(name) : name
   end

   def api_request?


Related issues

Related to Redmine - Defect #16711: Non-ascii attachment file name get corrupted in IE11 Closed

Actions
Actions

Also available in: Atom PDF