From 9cda28221faa0c8029a4f4e48f792478430c1681 Mon Sep 17 00:00:00 2001 From: Matt Miller Date: Fri, 16 Feb 2007 18:49:07 +0000 Subject: [PATCH] more gracefully handle iconv being missing git-svn-id: file:///home/svn/framework3/trunk@4400 4d416f70-5f16-0410-b530-b9f4589650da --- lib/rex/text.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/rex/text.rb b/lib/rex/text.rb index 1212265160..026b3f08c0 100644 --- a/lib/rex/text.rb +++ b/lib/rex/text.rb @@ -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 #