NewsDownloader: Strip byte order mark from xml string before parsing (#9468)

Fixes #9467
reviewable/pr9474/r1
Adam Goldsmith 2 years ago committed by GitHub
parent 2678d2c49b
commit f2b9c5bdaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -437,6 +437,10 @@ function NewsDownloader:deserializeXMLString(xml_str)
local libxml = require("lib/xml")
-- Instantiate the object that parses the XML file as a Lua table.
local xmlhandler = treehdl.simpleTreeHandler()
-- Remove UTF-8 byte order mark, as it will cause LuaXML to fail
xml_str = xml_str:gsub("^\xef\xbb\xbf", "", 1)
-- Instantiate the object that parses the XML to a Lua table.
local ok = pcall(function()
libxml.xmlParser(xmlhandler):parse(xml_str)

Loading…
Cancel
Save