summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-06-13 07:55:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-06-13 07:55:30 +0000
commit3077ed8d3a79fc613f31ecd47418fcec291cfd18 (patch)
tree0f8453bf59641e424808c03aae3e135adb202198 /lib
parent49914f010dfb0ae7245ff2b63ba4655a9e07cd79 (diff)
downloadredmine-3077ed8d3a79fc613f31ecd47418fcec291cfd18.tar.gz
redmine-3077ed8d3a79fc613f31ecd47418fcec291cfd18.zip
Add BOM to UTF-8 encoded CSV (#7037).
git-svn-id: http://svn.redmine.org/redmine/trunk@14303 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/export/csv.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/redmine/export/csv.rb b/lib/redmine/export/csv.rb
index ce43240ba..3762eb661 100644
--- a/lib/redmine/export/csv.rb
+++ b/lib/redmine/export/csv.rb
@@ -35,7 +35,13 @@ module Redmine
col_sep = l(:general_csv_separator)
encoding = l(:general_csv_encoding)
- super(:col_sep => col_sep, :encoding => encoding, &block)
+ str = ''.force_encoding(encoding)
+ if encoding == 'UTF-8'
+ # BOM
+ str = "\xEF\xBB\xBF".force_encoding(encoding)
+ end
+
+ super(str, :col_sep => col_sep, :encoding => encoding, &block)
end
end