Project

General

Profile

Patch #28112 ยป redmine_with_ruby250.patch

Sho HASHIMOTO, 2018-01-31 12:08

View differences:

lib/redmine/export/csv.rb
class Base < ::CSV
include Redmine::I18n
BOM = "\xEF\xBB\xBF".force_encoding('UTF-8')
class << self
def generate(&block)
col_sep = l(:general_csv_separator)
encoding = l(:general_csv_encoding)
str = ''.force_encoding(encoding)
if encoding == 'UTF-8'
# BOM
str = "\xEF\xBB\xBF".force_encoding(encoding)
res = super(:col_sep => col_sep, :encoding => encoding, &block)
if encoding == 'UTF-8' && !res.starts_with?(BOM)
res = BOM + res
end
super(str, :col_sep => col_sep, :encoding => encoding, &block)
return res
end
end
    (1-1/1)