From 00e1deeb862ba6895a02c7b4f1a26bef09288824 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 22 Feb 2015 15:59:29 +0000 Subject: [PATCH] Drop iconv which is deprecated and only needed for ruby 1.8 support --- Gemfile | 3 --- Gemfile.lock | 2 -- lib/utf8.rb | 18 +++--------------- 3 files changed, 3 insertions(+), 20 deletions(-) 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 -- 2.39.5