GitLab steht Mittwoch, den 08. Juli, zwischen 09:00 und 13:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit 21f7503f authored by maeda's avatar maeda

Import UTF-8 issue CSV files with BOM and quoted strings (#30412).

Patch by Felix Schäfer.


git-svn-id: https://svn.redmine.org/redmine/trunk@17786 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent d559816d
......@@ -217,6 +217,7 @@ class Import < ActiveRecord::Base
csv_options = {:headers => false}
csv_options[:encoding] = settings['encoding'].to_s.presence || 'UTF-8'
csv_options[:encoding] = 'bom|UTF-8' if csv_options[:encoding] == 'UTF-8'
separator = settings['separator'].to_s
csv_options[:col_sep] = separator if separator.size == 1
wrapper = settings['wrapper'].to_s
......
......@@ -116,6 +116,15 @@ class IssueImportTest < ActiveSupport::TestCase
assert_equal 2, issues[2].parent_id
end
def test_import_utf8_with_bom
import = generate_import_with_mapping('import_issues_utf8_with_bom.csv')
import.settings.merge!('encoding' => 'UTF-8')
import.save
issues = new_records(Issue,3) { import.run }
assert_equal 3, issues.count
end
def test_backward_and_forward_reference_to_parent_should_work
import = generate_import('import_subtasks.csv')
import.settings = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment