more gracefully handle iconv being missing

git-svn-id: file:///home/svn/framework3/trunk@4400 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2007-02-16 18:49:07 +00:00
parent 96a6131bf0
commit 9cda28221f
1 changed files with 6 additions and 2 deletions

View File

@ -1,8 +1,8 @@
require 'digest/md5'
require 'stringio'
require 'iconv'
begin
require 'iconv'
require 'zlib'
rescue LoadError
end
@ -124,7 +124,11 @@ module Text
# Converts ISO-8859-1 to UTF-8
#
def self.to_utf8(str)
Iconv.iconv("utf-8","iso-8859-1", str).join(" ")
begin
Iconv.iconv("utf-8","iso-8859-1", str).join(" ")
rescue
raise ::RuntimeError, "Your installation does not support iconv (needed for utf8 conversion)"
end
end
#