]> git.openstreetmap.org Git - rails.git/commitdiff
Drop iconv which is deprecated and only needed for ruby 1.8 support
authorTom Hughes <tom@compton.nu>
Sun, 22 Feb 2015 15:59:29 +0000 (15:59 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 22 Feb 2015 19:21:34 +0000 (19:21 +0000)
Gemfile
Gemfile.lock
lib/utf8.rb

diff --git a/Gemfile b/Gemfile
index 017f8f310f3dbb5b5cd5bc5ea01bd605a6c0626d..83a941d6fe2859cd1a01f92c2e1f182a35f69cc4 100644 (file)
--- 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"
 
index c06661496db7fa9ecede3367f4944d5402cb6fa6..f4a2c9b5b746b742c6d7453345a31daff30766c2 100644 (file)
@@ -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
index 9e9279deb000efa4933030304829e304008dd1fd..7865d62039566855efc105f54b7682d18974cd46 100644 (file)
@@ -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