pupnp / pupnp

libupnp: Build UPnP-compliant control points, devices, and bridges on several operating systems.
https://pupnp.github.io/pupnp
BSD 3-Clause "New" or "Revised" License
349 stars 114 forks source link

XML with leading UTF-8 BOM cannot be parsed #412

Closed rexcheung21 closed 1 year ago

rexcheung21 commented 1 year ago

The UpnpDownloadXmlDoc() function cannot download deviceinfoservice.xml from Belkin Wemo smart plug. The root cause is leading UTF-8 BOM (\xef\xbb\xbf) in the XML caused parse error. Several Microsoft software (Example: notepad) puts leading BOM into UTF-8 text files. The fix of the issue is detecting and skipping leading UTF-8 BOM at the start of parsing XML document.