Require iconv directly as rails no longer loads it
[rails.git] / lib / utf8.rb
1 require 'iconv'
2
3 module UTF8
4   ##
5   # Checks that a string is valid UTF-8 by trying to convert it to UTF-8
6   # using the iconv library, which is in the standard library.
7   def self.valid?(str)
8     return true if str.nil?
9     Iconv.conv("UTF-8", "UTF-8", str)
10     return true
11     
12   rescue
13     return false
14   end  
15 end
16