fix that diff outputs become ??? in some non ASCII words (#12641)

Contributed by Filou Centrinov.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11549 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2013-03-07 10:36:06 +00:00
parent 72539451aa
commit d3de07a17c
4 changed files with 73 additions and 0 deletions

View File

@@ -199,10 +199,16 @@ module Redmine
while starting < max && line_left[starting] == line_right[starting]
starting += 1
end
while line_left[starting].ord.between?(128, 191) && starting > 0
starting -= 1
end
ending = -1
while ending >= -(max - starting) && line_left[ending] == line_right[ending]
ending -= 1
end
while line_left[ending].ord.between?(128, 191) && ending > -1
ending -= 1
end
unless starting == 0 && ending == -1
[starting, ending]
end