Set the string encoding when parsing XML

Improves upon #1790

Fixes #1803
This commit is contained in:
Jordan Sissel 2014-09-29 23:57:25 +00:00
parent 7395512761
commit f7d7a7532a

View file

@ -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