From a1cd582c67b10abbda6c2fb2c99d8735138d33db Mon Sep 17 00:00:00 2001 From: Saito Date: Tue, 13 Dec 2011 00:41:31 +0800 Subject: fix can not guess problem --- lib/utils.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/utils.rb b/lib/utils.rb index 17c9dfe3dd2..2de14761444 100644 --- a/lib/utils.rb +++ b/lib/utils.rb @@ -18,13 +18,14 @@ module Utils module CharEncode def encode(string) + return '' unless string cd = CharDet.detect(string) if cd.confidence > 0.6 string.force_encoding(cd.encoding) end string.encode("utf-8", :undef => :replace, :replace => "?", :invalid => :replace) rescue - "Invalid code encoding" + "Invalid Encoding" end end -- cgit v1.2.1