mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Set the string encoding when parsing XML
Improves upon #1790 Fixes #1803
This commit is contained in:
parent
7395512761
commit
f7d7a7532a
1 changed files with 2 additions and 2 deletions
|
@ -91,7 +91,7 @@ class LogStash::Filters::Xml < LogStash::Filters::Base
|
||||||
|
|
||||||
if @xpath
|
if @xpath
|
||||||
begin
|
begin
|
||||||
doc = Nokogiri::XML(value)
|
doc = Nokogiri::XML(value, nil, value.encoding.to_s)
|
||||||
rescue => e
|
rescue => e
|
||||||
event.tag("_xmlparsefailure")
|
event.tag("_xmlparsefailure")
|
||||||
@logger.warn("Trouble parsing xml", :source => @source, :value => value,
|
@logger.warn("Trouble parsing xml", :source => @source, :value => value,
|
||||||
|
@ -115,7 +115,7 @@ class LogStash::Filters::Xml < LogStash::Filters::Base
|
||||||
unless value.nil?
|
unless value.nil?
|
||||||
matched = true
|
matched = true
|
||||||
event[xpath_dest] ||= []
|
event[xpath_dest] ||= []
|
||||||
event[xpath_dest] << value.to_str
|
event[xpath_dest] << value.to_s
|
||||||
end
|
end
|
||||||
end # XPath.each
|
end # XPath.each
|
||||||
end # @xpath.each
|
end # @xpath.each
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue