]> git.openstreetmap.org Git - rails.git/blobdiff - lib/utf8.rb
Restore loading spinner in richtext previews
[rails.git] / lib / utf8.rb
index 90b8f0413e99237b7a808d1d397301da3e021442..613e3005ea68aedf5815f0c37e023fda557ced8d 100644 (file)
@@ -1,16 +1,10 @@
-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  
-end
 
+    str.valid_encoding?
+  end
+end