]> git.openstreetmap.org Git - rails.git/blobdiff - lib/utf8.rb
Drop iconv which is deprecated and only needed for ruby 1.8 support
[rails.git] / lib / utf8.rb
index 90b8f0413e99237b7a808d1d397301da3e021442..7865d62039566855efc105f54b7682d18974cd46 100644 (file)
@@ -1,16 +1,9 @@
-require 'iconv'
-
 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.
   def self.valid?(str)
     return true if str.nil?
-    Iconv.conv("UTF-8", "UTF-8", str)
-    return true
-    
-  rescue
-    return false
-  end  
+    str.valid_encoding?
+  end
 end
-