Commit 12c01d74016c266b6acc798c0c1b68765afb4871

Authored by Saito
1 parent f114a4f3

fix encode bugs on diff not utf-8 encode's code

app/views/commits/_text_file.html.haml
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 - line_new = 0 2 - line_new = 0
3 - lines_arr = diff.diff.lines.to_a 3 - lines_arr = diff.diff.lines.to_a
4 - lines_arr.each do |line| 4 - lines_arr.each do |line|
5 - - encode(line) 5 + - line = encode(line)
6 - next if line.match(/^--- \/dev\/null/) 6 - next if line.match(/^--- \/dev\/null/)
7 - next if line.match(/^--- a/) 7 - next if line.match(/^--- a/)
8 - next if line.match(/^\+\+\+ b/) 8 - next if line.match(/^\+\+\+ b/)
@@ -29,12 +29,12 @@ module Utils @@ -29,12 +29,12 @@ module Utils
29 module Colorize 29 module Colorize
30 include CharEncode 30 include CharEncode
31 def colorize 31 def colorize
32 - system_colorize(encode(data), name) 32 + system_colorize(data, name)
33 end 33 end
34 34
35 def system_colorize(data, file_name) 35 def system_colorize(data, file_name)
36 ft = handle_file_type(file_name) 36 ft = handle_file_type(file_name)
37 - Pygments.highlight(data, :lexer => ft, :options => { :encoding => 'utf-8', :linenos => 'True' }) 37 + Pygments.highlight(encode(data), :lexer => ft, :options => { :encoding => 'utf-8', :linenos => 'True' })
38 end 38 end
39 39
40 def handle_file_type(file_name, mime_type = nil) 40 def handle_file_type(file_name, mime_type = nil)