Skip to content

Commit f7d7a75

Browse files
committed
Set the string encoding when parsing XML
Improves upon #1790 Fixes #1803
1 parent 7395512 commit f7d7a75

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/logstash/filters/xml.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def filter(event)
9191

9292
if @xpath
9393
begin
94-
doc = Nokogiri::XML(value)
94+
doc = Nokogiri::XML(value, nil, value.encoding.to_s)
9595
rescue => e
9696
event.tag("_xmlparsefailure")
9797
@logger.warn("Trouble parsing xml", :source => @source, :value => value,
@@ -115,7 +115,7 @@ def filter(event)
115115
unless value.nil?
116116
matched = true
117117
event[xpath_dest] ||= []
118-
event[xpath_dest] << value.to_str
118+
event[xpath_dest] << value.to_s
119119
end
120120
end # XPath.each
121121
end # @xpath.each

0 commit comments

Comments
 (0)