diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb index a0f1db195..1f9153fab 100644 --- a/lib/redmine/scm/adapters/mercurial_adapter.rb +++ b/lib/redmine/scm/adapters/mercurial_adapter.rb @@ -120,8 +120,12 @@ module Redmine def summary return @summary if @summary hg 'rhsummary' do |io| + output = io.read + if output.respond_to?(:force_encoding) + output.force_encoding('UTF-8') + end begin - @summary = ActiveSupport::XmlMini.parse(io.read)['rhsummary'] + @summary = ActiveSupport::XmlMini.parse(output)['rhsummary'] rescue end end @@ -132,8 +136,12 @@ module Redmine p1 = scm_iconv(@path_encoding, 'UTF-8', path) manifest = hg('rhmanifest', '-r', CGI.escape(hgrev(identifier)), CGI.escape(without_leading_slash(p1.to_s))) do |io| + output = io.read + if output.respond_to?(:force_encoding) + output.force_encoding('UTF-8') + end begin - ActiveSupport::XmlMini.parse(io.read)['rhmanifest']['repository']['manifest'] + ActiveSupport::XmlMini.parse(output)['rhmanifest']['repository']['manifest'] rescue end end @@ -175,9 +183,13 @@ module Redmine hg_args << '--limit' << options[:limit] if options[:limit] hg_args << hgtarget(path) unless path.blank? log = hg(*hg_args) do |io| + output = io.read + if output.respond_to?(:force_encoding) + output.force_encoding('UTF-8') + end begin # Mercurial < 1.5 does not support footer template for '' - ActiveSupport::XmlMini.parse("#{io.read}")['log'] + ActiveSupport::XmlMini.parse("#{output}")['log'] rescue end end diff --git a/lib/redmine/scm/adapters/subversion_adapter.rb b/lib/redmine/scm/adapters/subversion_adapter.rb index 1fad6e3fa..59f577e64 100644 --- a/lib/redmine/scm/adapters/subversion_adapter.rb +++ b/lib/redmine/scm/adapters/subversion_adapter.rb @@ -65,6 +65,9 @@ module Redmine info = nil shellout(cmd) do |io| output = io.read + if output.respond_to?(:force_encoding) + output.force_encoding('UTF-8') + end begin doc = ActiveSupport::XmlMini.parse(output) #root_url = doc.elements["info/entry/repository/root"].text @@ -94,6 +97,9 @@ module Redmine cmd << credentials_string shellout(cmd) do |io| output = io.read + if output.respond_to?(:force_encoding) + output.force_encoding('UTF-8') + end begin doc = ActiveSupport::XmlMini.parse(output) each_xml_element(doc['lists']['list'], 'entry') do |entry| @@ -134,6 +140,9 @@ module Redmine properties = {} shellout(cmd) do |io| output = io.read + if output.respond_to?(:force_encoding) + output.force_encoding('UTF-8') + end begin doc = ActiveSupport::XmlMini.parse(output) each_xml_element(doc['properties']['target'], 'property') do |property| @@ -158,6 +167,9 @@ module Redmine cmd << ' ' + target(path) shellout(cmd) do |io| output = io.read + if output.respond_to?(:force_encoding) + output.force_encoding('UTF-8') + end begin doc = ActiveSupport::XmlMini.parse(output) each_xml_element(doc['log'], 'logentry') do |logentry|