summaryrefslogtreecommitdiff
path: root/lib/gitlabhq/encode.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlabhq/encode.rb')
-rw-r--r--lib/gitlabhq/encode.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/gitlabhq/encode.rb b/lib/gitlabhq/encode.rb
index 11d9bd7bfd9..55e86192ad4 100644
--- a/lib/gitlabhq/encode.rb
+++ b/lib/gitlabhq/encode.rb
@@ -3,6 +3,8 @@ module Gitlabhq
extend self
def utf8 message
+ return nil unless message
+
hash = CharlockHolmes::EncodingDetector.detect(message) rescue {}
if hash[:encoding]
CharlockHolmes::Converter.convert(message, hash[:encoding], 'UTF-8')