From 89c17aad3093fb8c74a42e238d5b2a90f5ceee49 Mon Sep 17 00:00:00 2001 From: zzjin Date: Sun, 13 May 2012 23:31:14 +0800 Subject: [PATCH] Update lib/graph_commit.rb --- lib/graph_commit.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/graph_commit.rb b/lib/graph_commit.rb index 0080e856402..2b90fab6050 100644 --- a/lib/graph_commit.rb +++ b/lib/graph_commit.rb @@ -1,3 +1,4 @@ +require 'charlock_holmes/string' require "grit" class GraphCommit @@ -96,13 +97,14 @@ class GraphCommit h[:parents] = self.parents.collect do |p| [p.id,0,0] end - h[:author] = author.name.force_encoding("UTF-8") + 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] = message.force_encoding("UTF-8") + detection = CharlockHolmes::EncodingDetector.detect(message) + h[:message] = CharlockHolmes::Converter.convert message, detection[:encoding], 'UTF-8' h[:login] = author.email h end -- GitLab