Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-04-12 00:03:56 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-04-12 00:03:56 +0400
commitb7558a2063a35778e226156ff7b5ab41d83be753 (patch)
treed14d065b729d933150c6770860f8d5bb7d86206a /lib
parent52f6df7255ed40186bd1a0e92abaaf2b926f3817 (diff)
Removed encoding monkey patch
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlabhq/encode.rb14
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