From 2d1866d966d94c688f9cb87c5bf3f096dffac844 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 22 Oct 2014 17:37:16 +0000 Subject: Merged rails-4.1 branch (#14534). git-svn-id: http://svn.redmine.org/redmine/trunk@13482 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/tasks/migrate_from_trac.rake | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'lib/tasks/migrate_from_trac.rake') diff --git a/lib/tasks/migrate_from_trac.rake b/lib/tasks/migrate_from_trac.rake index 0d1af9abc..d1a3873f5 100644 --- a/lib/tasks/migrate_from_trac.rake +++ b/lib/tasks/migrate_from_trac.rake @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. require 'active_record' -require 'iconv' if RUBY_VERSION < '1.9' require 'pp' namespace :redmine do @@ -155,7 +154,7 @@ namespace :redmine do attachment_type = read_attribute(:type) #replace exotic characters with their hex representation to avoid invalid filenames trac_file = filename.gsub( /[^a-zA-Z0-9\-_\.!~*']/n ) do |x| - codepoint = RUBY_VERSION < '1.9' ? x[0] : x.codepoints.to_a[0] + codepoint = x.codepoints.to_a[0] sprintf('%%%02x', codepoint) end "#{TracMigrate.trac_attachments_directory}/#{attachment_type}/#{id}/#{trac_file}" @@ -715,12 +714,7 @@ namespace :redmine do end def self.encode(text) - if RUBY_VERSION < '1.9' - @ic ||= Iconv.new('UTF-8', @charset) - @ic.iconv text - else - text.to_s.force_encoding(@charset).encode('UTF-8') - end + text.to_s.force_encoding(@charset).encode('UTF-8') end end -- cgit v1.2.3