projects
/
rails.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Localisation updates from translatewiki.net (2010-04-03)
[rails.git]
/
lib
/
utf8.rb
1
module UTF8
2
##
3
# Checks that a string is valid UTF-8 by trying to convert it to UTF-8
4
# using the iconv library, which is in the standard library.
5
def self.valid?(str)
6
return true if str.nil?
7
Iconv.conv("UTF-8", "UTF-8", str)
8
return true
9
10
rescue
11
return false
12
end
13
end
14