From 7ee2a9b40f2ee555e4c06df536c66a8e15c11715 Mon Sep 17 00:00:00 2001 From: RedMickey Date: Fri, 2 Sep 2022 15:04:37 +0300 Subject: [PATCH] Allow single quotes in encoding parsing regexp --- lib/xml-stream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xml-stream.js b/lib/xml-stream.js index 7121ffd..5d0e490 100644 --- a/lib/xml-stream.js +++ b/lib/xml-stream.js @@ -536,7 +536,7 @@ function parse() { preludeBuffers.push(data); prelude += data.toString(); if (/^\s*<[^>]+>/.test(prelude)) { - var matches = prelude.match(/^\s*<\?xml[^>]+encoding="(.+?)"[^>]*\?>/); + var matches = prelude.match(/^\s*<\?xml[^>]+encoding=['"](.+?)['"][^>]*\?>/); self._encoding = matches ? matches[1] : 'utf8'; self._encoder = makeEncoder(self._encoding); for (var i = 0, n = preludeBuffers.length; i < n; i++) {