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 2 - line_new = 0
3 3 - lines_arr = diff.diff.lines.to_a
4 4 - lines_arr.each do |line|
5   - - encode(line)
  5 + - line = encode(line)
6 6 - next if line.match(/^--- \/dev\/null/)
7 7 - next if line.match(/^--- a/)
8 8 - next if line.match(/^\+\+\+ b/)
... ...
lib/utils.rb
... ... @@ -29,12 +29,12 @@ module Utils
29 29 module Colorize
30 30 include CharEncode
31 31 def colorize
32   - system_colorize(encode(data), name)
  32 + system_colorize(data, name)
33 33 end
34 34  
35 35 def system_colorize(data, file_name)
36 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 38 end
39 39  
40 40 def handle_file_type(file_name, mime_type = nil)
... ...