From f7d7a7532abd2c45ceebcb476d43f8504ab6d3df Mon Sep 17 00:00:00 2001 From: Jordan Sissel Date: Mon, 29 Sep 2014 23:57:25 +0000 Subject: [PATCH] Set the string encoding when parsing XML Improves upon #1790 Fixes #1803 --- lib/logstash/filters/xml.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/logstash/filters/xml.rb b/lib/logstash/filters/xml.rb index 2702631c8..4fcf770e5 100644 --- a/lib/logstash/filters/xml.rb +++ b/lib/logstash/filters/xml.rb @@ -91,7 +91,7 @@ class LogStash::Filters::Xml < LogStash::Filters::Base if @xpath begin - doc = Nokogiri::XML(value) + doc = Nokogiri::XML(value, nil, value.encoding.to_s) rescue => e event.tag("_xmlparsefailure") @logger.warn("Trouble parsing xml", :source => @source, :value => value, @@ -115,7 +115,7 @@ class LogStash::Filters::Xml < LogStash::Filters::Base unless value.nil? matched = true event[xpath_dest] ||= [] - event[xpath_dest] << value.to_str + event[xpath_dest] << value.to_s end end # XPath.each end # @xpath.each