15 lines
324 B
Ruby
15 lines
324 B
Ruby
module Gitlabhq
|
|
module Encode
|
|
extend self
|
|
|
|
def utf8 message
|
|
hash = CharlockHolmes::EncodingDetector.detect(message) rescue {}
|
|
if hash[:encoding]
|
|
CharlockHolmes::Converter.convert(message, hash[:encoding], 'UTF-8')
|
|
else
|
|
message
|
|
end.force_encoding("utf-8")
|
|
end
|
|
end
|
|
end
|