summaryrefslogtreecommitdiffstats
path: root/lib/redmine
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-05-07 01:13:12 +0000
committerGo MAEDA <maeda@farend.jp>2018-05-07 01:13:12 +0000
commitca2875fab2c3c3d96dcdbad5c3eb1068887dadd4 (patch)
tree5cc6aa92db02475ea06e2be225b91cb985d9f027 /lib/redmine
parent43d9bea7c5da32a99c3ebdb828e23d6a02c31c12 (diff)
downloadredmine-ca2875fab2c3c3d96dcdbad5c3eb1068887dadd4.tar.gz
redmine-ca2875fab2c3c3d96dcdbad5c3eb1068887dadd4.zip
Allow switching the encoding to UTF-8 when exporting to CSV (#26279).
Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@17328 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r--lib/redmine/export/csv.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/redmine/export/csv.rb b/lib/redmine/export/csv.rb
index dfbe36f4f..b0d48ef6f 100644
--- a/lib/redmine/export/csv.rb
+++ b/lib/redmine/export/csv.rb
@@ -31,12 +31,12 @@ module Redmine
class << self
- def generate(&block)
+ def generate(options = {}, &block)
col_sep = l(:general_csv_separator)
- encoding = l(:general_csv_encoding)
+ encoding = Encoding.find(options[:encoding]) rescue Encoding.find(l(:general_csv_encoding))
str = ''.force_encoding(encoding)
- if encoding == 'UTF-8'
+ if encoding == Encoding::UTF_8
# BOM
str = "\xEF\xBB\xBF".force_encoding(encoding)
end