From a701bd5fbd3400e3bfe54973d949c853666c3648 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Mon, 17 Sep 2012 23:46:53 +0000 Subject: [PATCH] scm: bazaar: convert path encoding from @path_encoding to UTF-8 at adapter entries method (#11834) git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10418 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/scm/adapters/bazaar_adapter.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/redmine/scm/adapters/bazaar_adapter.rb b/lib/redmine/scm/adapters/bazaar_adapter.rb index 976e68787..7f04cda83 100644 --- a/lib/redmine/scm/adapters/bazaar_adapter.rb +++ b/lib/redmine/scm/adapters/bazaar_adapter.rb @@ -91,13 +91,17 @@ module Redmine cmd_args << "-r#{identifier.to_i}" cmd_args << bzr_target(path) scm_cmd(*cmd_args) do |io| - prefix = "#{url}/#{path}".gsub('\\', '/') - logger.debug "PREFIX: #{prefix}" + prefix_utf8 = "#{url}/#{path}".gsub('\\', '/') + logger.debug "PREFIX: #{prefix_utf8}" + prefix = scm_iconv(@path_encoding, 'UTF-8', prefix_utf8) + prefix.force_encoding('ASCII-8BIT') if prefix.respond_to?(:force_encoding) re = %r{^V\s+(#{Regexp.escape(prefix)})?(\/?)([^\/]+)(\/?)\s+(\S+)\r?$} io.each_line do |line| next unless line =~ re - entries << Entry.new({:name => $3.strip, - :path => ((path.empty? ? "" : "#{path}/") + $3.strip), + name_locale = $3.strip + name = scm_iconv('UTF-8', @path_encoding, name_locale) + entries << Entry.new({:name => name, + :path => ((path.empty? ? "" : "#{path}/") + name), :kind => ($4.blank? ? 'file' : 'dir'), :size => nil, :lastrev => Revision.new(:revision => $5.strip)