From: Tom Hughes Date: Sun, 22 Feb 2015 15:59:29 +0000 (+0000) Subject: Drop iconv which is deprecated and only needed for ruby 1.8 support X-Git-Tag: live~4242 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/00e1deeb862ba6895a02c7b4f1a26bef09288824 Drop iconv which is deprecated and only needed for ruby 1.8 support --- diff --git a/Gemfile b/Gemfile index 017f8f310..83a941d6f 100644 --- a/Gemfile +++ b/Gemfile @@ -58,9 +58,6 @@ gem "ruby-openid", ">= 2.2.0" # Markdown formatting support gem "redcarpet" -# Character conversion support for ruby 1.8 -gem "iconv", "= 0.1", :platforms => :ruby_18 - # Load libxml support for XML parsing and generation gem "libxml-ruby", ">= 2.0.5", :require => "libxml" diff --git a/Gemfile.lock b/Gemfile.lock index c06661496..f4a2c9b5b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,7 +84,6 @@ GEM http_accept_language (2.0.5) httpclient (2.6.0.1) i18n (0.7.0) - iconv (0.1) jquery-rails (4.0.3) rails-dom-testing (~> 1.0) railties (>= 4.2.0) @@ -251,7 +250,6 @@ DEPENDENCIES htmlentities http_accept_language (~> 2.0.0) httpclient - iconv (= 0.1) jquery-rails json jsonify-rails diff --git a/lib/utf8.rb b/lib/utf8.rb index 9e9279deb..7865d6203 100644 --- a/lib/utf8.rb +++ b/lib/utf8.rb @@ -2,20 +2,8 @@ module UTF8 ## # Checks that a string is valid UTF-8 by trying to convert it to UTF-8 # using the iconv library, which is in the standard library. - if "".respond_to?("valid_encoding?") - def self.valid?(str) - return true if str.nil? - str.valid_encoding? - end - else - require "iconv" - - def self.valid?(str) - return true if str.nil? - Iconv.conv("UTF-8", "UTF-8", str) - return true - rescue - return false - end + def self.valid?(str) + return true if str.nil? + str.valid_encoding? end end