diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-04-12 00:03:56 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-04-12 00:03:56 +0400 |
commit | b7558a2063a35778e226156ff7b5ab41d83be753 (patch) | |
tree | d14d065b729d933150c6770860f8d5bb7d86206a /lib | |
parent | 52f6df7255ed40186bd1a0e92abaaf2b926f3817 (diff) |
Removed encoding monkey patch
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlabhq/encode.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/gitlabhq/encode.rb b/lib/gitlabhq/encode.rb new file mode 100644 index 00000000000..a493fb21192 --- /dev/null +++ b/lib/gitlabhq/encode.rb @@ -0,0 +1,14 @@ +module Gitlabhq + module Encode + extend self + + def utf8 message + hash = CharlockHolmes::EncodingDetector.detect(message) + if hash[:encoding] + CharlockHolmes::Converter.convert(message, hash[:encoding], 'UTF-8') + else + message + end.force_encoding("utf-8") + end + end +end |