Commit 12c01d74 authored by Saito's avatar Saito

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

parent f114a4f3
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- line_new = 0 - line_new = 0
- lines_arr = diff.diff.lines.to_a - lines_arr = diff.diff.lines.to_a
- lines_arr.each do |line| - lines_arr.each do |line|
- encode(line) - line = encode(line)
- next if line.match(/^--- \/dev\/null/) - next if line.match(/^--- \/dev\/null/)
- next if line.match(/^--- a/) - next if line.match(/^--- a/)
- next if line.match(/^\+\+\+ b/) - next if line.match(/^\+\+\+ b/)
......
...@@ -29,12 +29,12 @@ module Utils ...@@ -29,12 +29,12 @@ module Utils
module Colorize module Colorize
include CharEncode include CharEncode
def colorize def colorize
system_colorize(encode(data), name) system_colorize(data, name)
end end
def system_colorize(data, file_name) def system_colorize(data, file_name)
ft = handle_file_type(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 end
def handle_file_type(file_name, mime_type = nil) def handle_file_type(file_name, mime_type = nil)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment