postal-mime 2.7.4 → 2.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/decode-strings.cjs +6 -1
- package/package.json +1 -1
- package/src/decode-strings.js +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.7.5](https://github.com/postalsys/postal-mime/compare/v2.7.4...v2.7.5) (2026-06-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* decode iso-8859-8-i and iso-8859-8-e charsets as iso-8859-8 ([d7af50b](https://github.com/postalsys/postal-mime/commit/d7af50b7b0ebcd8e12c40942083382636aed7f66))
|
|
9
|
+
|
|
3
10
|
## [2.7.4](https://github.com/postalsys/postal-mime/compare/v2.7.3...v2.7.4) (2026-03-17)
|
|
4
11
|
|
|
5
12
|
|
package/dist/decode-strings.cjs
CHANGED
|
@@ -62,8 +62,13 @@ function decodeBase64(base64) {
|
|
|
62
62
|
}
|
|
63
63
|
return arrayBuffer;
|
|
64
64
|
}
|
|
65
|
+
const charsetAliases = /* @__PURE__ */ new Map([
|
|
66
|
+
["iso-8859-8-i", "iso-8859-8"],
|
|
67
|
+
["iso-8859-8-e", "iso-8859-8"]
|
|
68
|
+
]);
|
|
65
69
|
function getDecoder(charset) {
|
|
66
|
-
charset = charset || "utf8";
|
|
70
|
+
charset = (charset || "utf8").trim().toLowerCase();
|
|
71
|
+
charset = charsetAliases.get(charset) || charset;
|
|
67
72
|
let decoder;
|
|
68
73
|
try {
|
|
69
74
|
decoder = new TextDecoder(charset);
|
package/package.json
CHANGED
package/src/decode-strings.js
CHANGED
|
@@ -42,8 +42,21 @@ export function decodeBase64(base64) {
|
|
|
42
42
|
return arrayBuffer;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
// Charset aliases that the WHATWG Encoding Standard (and thus TextDecoder in
|
|
46
|
+
// browsers and Workers) does not recognize, but that map cleanly to a supported
|
|
47
|
+
// encoding. Node's ICU-backed TextDecoder resolves these natively; strict WHATWG
|
|
48
|
+
// runtimes would otherwise throw and fall back to windows-1252, emitting mojibake.
|
|
49
|
+
// eg. Hebrew bodies declared as the logical (iso-8859-8-i) or explicit (iso-8859-8-e)
|
|
50
|
+
// variants decode to the same code points as iso-8859-8.
|
|
51
|
+
const charsetAliases = new Map([
|
|
52
|
+
['iso-8859-8-i', 'iso-8859-8'],
|
|
53
|
+
['iso-8859-8-e', 'iso-8859-8']
|
|
54
|
+
]);
|
|
55
|
+
|
|
45
56
|
export function getDecoder(charset) {
|
|
46
|
-
charset = charset || 'utf8';
|
|
57
|
+
charset = (charset || 'utf8').trim().toLowerCase();
|
|
58
|
+
charset = charsetAliases.get(charset) || charset;
|
|
59
|
+
|
|
47
60
|
let decoder;
|
|
48
61
|
|
|
49
62
|
try {
|