mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2024-12-23 08:30:38 +01:00
Improved charset detection in HTML source code
This commit is contained in:
parent
c1adace8c3
commit
91527a186c
@ -64,10 +64,7 @@ manipulateDOM._removeCrossOriginAndIntegrityAttr = function (details) {
|
|||||||
if (!charset) {
|
if (!charset) {
|
||||||
//content-type has no charset declared
|
//content-type has no charset declared
|
||||||
let htmlHead = asciiDecoder.decode(evt.data, {stream: false});
|
let htmlHead = asciiDecoder.decode(evt.data, {stream: false});
|
||||||
let charsetMatch = htmlHead.match(/<meta\s+charset=["']?([^>"'\/]+)["'>\/]/i);
|
let charsetMatch = htmlHead.match(/<meta.*charset=["']?([^>"'\/]+)["'].*[>\/]/i);
|
||||||
if (!charsetMatch) {
|
|
||||||
charsetMatch = htmlHead.match(/<meta\s+http-equiv=["']?content-type["']?\s+content=["']?text\/html;\s*charset=([^>"'\/]+)["'>\/]/i);
|
|
||||||
}
|
|
||||||
charset = charsetMatch ? charsetMatch[1] : "UTF-8";
|
charset = charsetMatch ? charsetMatch[1] : "UTF-8";
|
||||||
}
|
}
|
||||||
decoder = new TextDecoder(charset);
|
decoder = new TextDecoder(charset);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
New in LocalCDN:
|
New in LocalCDN:
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
<li></li>
|
<li>Improved charset detection in HTML source code</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="topic-label">
|
<div class="topic-label">
|
||||||
Please update your uBlock/uMatrix rules
|
Please update your uBlock/uMatrix rules
|
||||||
|
Loading…
Reference in New Issue
Block a user