Skip to content

Commit 6bb1a46

Browse files
committed
Add UTF-8 encoding hints
text/plain (vs. application/json) should have charset specified: - https://datatracker.ietf.org/doc/html/rfc1521#section-7.1.1 Apart from that, specify @charset in "viewer.css" to ensure correct decoding of generated 'content' declarations: - https://developer.mozilla.org/en-US/docs/Web/CSS/@charset Fixes bhollis#218
1 parent a10aae5 commit 6bb1a46

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/background-firefox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function detectJSON(event: chrome.webRequest.WebResponseHeadersDetails) {
2626
if (typeof browser !== "undefined" && "filterResponseData" in browser.webRequest) {
2727
// We need to change the content type to text/plain to prevent Firefox
2828
// from using its built-in JSON viewer.
29-
header.value = "text/plain";
29+
header.value = "text/plain; charset=UTF-8";
3030
}
3131
}
3232
}

src/viewer.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@charset "UTF-8";
2+
13
body {
24
font-family: sans-serif;
35
margin: 0;

0 commit comments

Comments
 (0)