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:
authorSaito <saitowu@gmail.com>2011-12-30 17:41:39 +0400
committerSaito <saitowu@gmail.com>2011-12-30 17:41:39 +0400
commit14023c4e5a3241d06a8a021bab1183e4a9742b28 (patch)
treeaa6f8364bd37bd07f3399863e68e0fdd8dd4dbec /lib
parent7279e8c1774f3116dd74ca462447189730f9eff8 (diff)
remove charencode.
Diffstat (limited to 'lib')
-rw-r--r--lib/graph_commit.rb5
-rw-r--r--lib/utils.rb16
2 files changed, 3 insertions, 18 deletions
diff --git a/lib/graph_commit.rb b/lib/graph_commit.rb
index 1fcb9e78ef0..54550d99cf6 100644
--- a/lib/graph_commit.rb
+++ b/lib/graph_commit.rb
@@ -1,7 +1,6 @@
require "grit"
class GraphCommit
- include Utils::CharEncode
attr_accessor :time, :space
attr_accessor :refs
@@ -97,13 +96,13 @@ class GraphCommit
h[:parents] = self.parents.collect do |p|
[p.id,0,0]
end
- h[:author] = encode(author.name)
+ h[:author] = author.name
h[:time] = time
h[:space] = space
h[:refs] = refs.collect{|r|r.name}.join(" ") unless refs.nil?
h[:id] = sha
h[:date] = date
- h[:message] = encode(message)
+ h[:message] = message
h[:login] = author.email
h
end
diff --git a/lib/utils.rb b/lib/utils.rb
index 2de14761444..677322c98d4 100644
--- a/lib/utils.rb
+++ b/lib/utils.rb
@@ -16,28 +16,14 @@ module Utils
end
end
- 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 Encoding"
- end
- end
-
module Colorize
- include CharEncode
def colorize
system_colorize(data, name)
end
def system_colorize(data, file_name)
ft = handle_file_type(file_name)
- Pygments.highlight(encode(data), :lexer => ft, :options => { :encoding => 'utf-8', :linenos => 'True' })
+ Pygments.highlight(data, :lexer => ft, :options => { :encoding => 'utf-8', :linenos => 'True' })
end
def handle_file_type(file_name, mime_type = nil)