diff options
Diffstat (limited to 'lib/tasks/migrate_from_trac.rake')
-rw-r--r-- | lib/tasks/migrate_from_trac.rake | 10 |
1 files changed, 2 insertions, 8 deletions
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 |