diff options
author | Saito <saitowu@gmail.com> | 2011-12-13 00:41:31 +0800 |
---|---|---|
committer | Saito <saitowu@gmail.com> | 2011-12-13 00:41:31 +0800 |
commit | f615c877bcb36aa2e4bc399545376671b55f167e (patch) | |
tree | 3749645bb60dd9db9e1b95d93a8f570f962970fe /lib | |
parent | 822c0a506043a2e5ba0a58769b398cfe91d3df47 (diff) | |
download | gitlab-ce-f615c877bcb36aa2e4bc399545376671b55f167e.tar.gz |
fix can not guess problem
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils.rb | 3 |
1 files changed, 2 insertions, 1 deletions
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 |