diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/unified_diff.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/redmine/unified_diff.rb b/lib/redmine/unified_diff.rb index 6fbfb80fe..968922a50 100644 --- a/lib/redmine/unified_diff.rb +++ b/lib/redmine/unified_diff.rb @@ -199,15 +199,19 @@ 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 + unless "".respond_to?(:force_encoding) + while line_left[starting].ord.between?(128, 191) && starting > 0 + starting -= 1 + end 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 + unless "".respond_to?(:force_encoding) + while line_left[ending].ord.between?(128, 191) && ending > -1 + ending -= 1 + end end unless starting == 0 && ending == -1 [starting, ending] |