fix encode bugs on diff not utf-8 encode's code
This commit is contained in:
parent
f114a4f349
commit
12c01d7401
2 changed files with 3 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
|||
- line_new = 0
|
||||
- lines_arr = diff.diff.lines.to_a
|
||||
- lines_arr.each do |line|
|
||||
- encode(line)
|
||||
- line = encode(line)
|
||||
- next if line.match(/^--- \/dev\/null/)
|
||||
- next if line.match(/^--- a/)
|
||||
- next if line.match(/^\+\+\+ b/)
|
||||
|
|
|
@ -29,12 +29,12 @@ module Utils
|
|||
module Colorize
|
||||
include CharEncode
|
||||
def colorize
|
||||
system_colorize(encode(data), name)
|
||||
system_colorize(data, name)
|
||||
end
|
||||
|
||||
def system_colorize(data, file_name)
|
||||
ft = handle_file_type(file_name)
|
||||
Pygments.highlight(data, :lexer => ft, :options => { :encoding => 'utf-8', :linenos => 'True' })
|
||||
Pygments.highlight(encode(data), :lexer => ft, :options => { :encoding => 'utf-8', :linenos => 'True' })
|
||||
end
|
||||
|
||||
def handle_file_type(file_name, mime_type = nil)
|
||||
|
|
Loading…
Reference in a new issue