Skip to content

Commit

Permalink
Set the string encoding when parsing XML
Browse files Browse the repository at this point in the history
Improves upon elastic#1790

Fixes elastic#1803
  • Loading branch information
jordansissel committed Sep 29, 2014
1 parent 7395512 commit f7d7a75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/logstash/filters/xml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def filter(event)

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,
Expand All @@ -115,7 +115,7 @@ def filter(event)
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
Expand Down

0 comments on commit f7d7a75

Please sign in to comment.