I'm trying to parse an RSS url from a WordPress blog and getting the following error message on let feed = await parser.parseURL('https://mywordpressblog.com/feed'). The weird thing is that this was working, and I'm sure I haven't changed that part of the code recently.
Error: Non-whitespace before first tag.
Line: 0
Column: 1
Char:
I found issue #95 , and tried using some xml2js passthrough options that I found relevant without success. I've also tried all the options listed below isolated one by one.
While googling, some people seemed to have issues with their files being incorrectly encoded. Looking through the Linux terminal trying to determine the encoding, file -i bot.js returns bot.js: text/plain; charset=utf-8, and uchardet bot.js returns ISO-8859-15 which seems a bit weird to me.
I tried to convert the file encoding through the Linux terminal with iconv -f ISO-8859-15 -t UTF-8 bot.js -o bot2.js. Now both file -i bot2.js and uchardet bot2.js says utf-8, but I still receive the same error message when running the code.
I'm coding in Visual Studio Code and I've tried both re-opening and saving as UTF-8 and UTF-8 with BOM to no avail.
I should add that this error occurs both on my development machine, and on the production. I'm at loss here, anyone got any suggestions?
Never mind. It seemed to have something to do with the WordPress plugin SG-Optimizer from SiteGround that was the culprit. Deactivating fixed the issue. Closing
Hello,
I'm trying to parse an RSS url from a WordPress blog and getting the following error message on
let feed = await parser.parseURL('https://mywordpressblog.com/feed')
. The weird thing is that this was working, and I'm sure I haven't changed that part of the code recently.I found issue #95 , and tried using some xml2js passthrough options that I found relevant without success. I've also tried all the options listed below isolated one by one.
While googling, some people seemed to have issues with their files being incorrectly encoded. Looking through the Linux terminal trying to determine the encoding,
file -i bot.js
returnsbot.js: text/plain; charset=utf-8
, anduchardet bot.js
returnsISO-8859-15
which seems a bit weird to me.I tried to convert the file encoding through the Linux terminal with
iconv -f ISO-8859-15 -t UTF-8 bot.js -o bot2.js
. Now bothfile -i bot2.js
anduchardet bot2.js
says utf-8, but I still receive the same error message when running the code.I'm coding in Visual Studio Code and I've tried both re-opening and saving as UTF-8 and UTF-8 with BOM to no avail.
I should add that this error occurs both on my development machine, and on the production. I'm at loss here, anyone got any suggestions?
Thank you in advance, Mattias