Strip invalid quotes around charset
in feed responses
E.g., https://bmcmedethics.biomedcentral.com/articles/most-recent/rss.xml
This commit is contained in:
parent
dc47650eb3
commit
ddacfc0b8a
1 changed files with 5 additions and 1 deletions
|
@ -67,7 +67,11 @@ class SAXXMLReader {
|
|||
let charset = response.headers.get("Content-Type")
|
||||
?.match(/charset=([^;]+)/)
|
||||
?.[1];
|
||||
if (!charset) {
|
||||
if (charset) {
|
||||
// Strip surrounding quotes, which are invalid
|
||||
charset = charset.replace(/^["']|["']$/g, '');
|
||||
}
|
||||
else {
|
||||
charset = 'utf-8';
|
||||
}
|
||||
this._data = new TextDecoder(charset).decode(buf);
|
||||
|
|
Loading…
Reference in a new issue