aboutsummaryrefslogtreecommitdiff
path: root/bg/ResponseMetaData.js
diff options
context:
space:
mode:
authorhackademix <giorgio@maone.net>2019-03-11 22:35:46 +0100
committerhackademix <giorgio@maone.net>2019-03-11 22:35:46 +0100
commit2a272e97c076c8a0f13a1f0f5140ad5d72cbd890 (patch)
tree68f21afb0693f6464ba12cad3d08621590c01a30 /bg/ResponseMetaData.js
parent42a2d31b272a2934824e038e8d9c73f19bab006c (diff)
Correctly decode using the original document charset and force re-encoding via UTF-8 BOM only when needed.
Diffstat (limited to 'bg/ResponseMetaData.js')
-rw-r--r--bg/ResponseMetaData.js18
1 files changed, 1 insertions, 17 deletions
diff --git a/bg/ResponseMetaData.js b/bg/ResponseMetaData.js
index 41d1fe9..5a75a3c 100644
--- a/bg/ResponseMetaData.js
+++ b/bg/ResponseMetaData.js
@@ -37,7 +37,6 @@ class ResponseMetaData {
this.headers[propertyName] = h;
}
}
- this.forcedUTF8 = false;
}
get charset() {
@@ -52,21 +51,6 @@ class ResponseMetaData {
return charset;
}
- get isUTF8() {
- return /^utf-?8$/i.test(this.charset);
- }
-
- forceUTF8() {
- if (!(this.forcedUTF8 || this.isUTF8)) {
- let h = this.headers.contentType;
- if (h) {
- h.value = h.value.replace(/;\s*charset\s*=.*|$/, "; charset=utf8");
- this.forcedUTF8 = true;
- } // if the header doesn't exist the browser should default to UTF-8 anyway
- }
- return this.forcedUTF8;
- }
-
createDecoder() {
if (this.charset) {
try {
@@ -75,7 +59,7 @@ class ResponseMetaData {
console.error(e);
}
}
- return new TextDecoder("utf-8");
+ return new TextDecoder("latin1");
}
};