]> source.dussan.org Git - redmine.git/commitdiff
Set UTF-8 as the default CSV export encoding (#41202).
authorGo MAEDA <maeda@farend.jp>
Sun, 1 Sep 2024 04:25:23 +0000 (04:25 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 1 Sep 2024 04:25:23 +0000 (04:25 +0000)
Patch by Go MAEDA (user:maeda).

git-svn-id: https://svn.redmine.org/redmine/trunk@23007 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
test/helpers/application_helper_test.rb

index 49e8b0a82fdc93c52575d398ba30b0e350203025..a677b80a8831d13ebd747de48bc8d96c1956bdb8 100644 (file)
@@ -1830,12 +1830,12 @@ module ApplicationHelper
   def export_csv_encoding_select_tag
     return if l(:general_csv_encoding).casecmp('UTF-8') == 0
 
-    options = [l(:general_csv_encoding), 'UTF-8']
+    options = ['UTF-8', l(:general_csv_encoding)]
     content_tag(:p) do
       concat(
         content_tag(:label) do
-          concat l(:label_encoding) + ' '
-          concat select_tag('encoding', options_for_select(options, l(:general_csv_encoding)))
+          concat "#{l(:label_encoding)} "
+          concat select_tag('encoding', options_for_select(options, 'UTF-8'))
         end
       )
     end
index c91ca37a056dcefe7d8974a9f4b7e39f88c16e37..ab0d8f91f16ec442f602ceb2c553efe89832ff69 100644 (file)
@@ -2277,12 +2277,10 @@ class ApplicationHelperTest < Redmine::HelperTest
 
   def test_export_csv_encoding_select_tag_should_have_two_option_when_general_csv_encoding_is_not_UTF8
     with_locale 'en' do
-      assert_not_equal l(:general_csv_encoding), 'UTF-8'
+      assert_equal l(:general_csv_encoding), 'ISO-8859-1'
       result = export_csv_encoding_select_tag
-      assert_select_in result,
-                       "option[selected='selected'][value=#{l(:general_csv_encoding)}]",
-                       :text => l(:general_csv_encoding)
-      assert_select_in result, "option[value='UTF-8']", :text => 'UTF-8'
+      assert_select_in result, "option[selected='selected'][value='UTF-8']", :text => 'UTF-8'
+      assert_select_in result, "option[value='ISO-8859-1']", :text => 'ISO-8859-1'
     end
   end