libmime 4.2.0 → 4.2.1
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 +4 -0
- package/lib/charset.js +17 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/lib/charset.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const iconv = require('iconv-lite');
|
|
4
|
-
const
|
|
4
|
+
const encodingJapanese = require('encoding-japanese');
|
|
5
5
|
const charsets = require('./charsets');
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -43,7 +43,22 @@ const charset = (module.exports = {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (/^jis|^iso-?2022-?jp|^EUCJP/i.test(fromCharset)) {
|
|
46
|
-
|
|
46
|
+
if (typeof buf === 'string') {
|
|
47
|
+
buf = Buffer.from(buf);
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
let output = encodingJapanese.convert(buf, {
|
|
51
|
+
to: 'UNICODE',
|
|
52
|
+
from: fromCharset,
|
|
53
|
+
type: 'string'
|
|
54
|
+
});
|
|
55
|
+
if (typeof output === 'string') {
|
|
56
|
+
output = Buffer.from(output);
|
|
57
|
+
}
|
|
58
|
+
return output;
|
|
59
|
+
} catch (err) {
|
|
60
|
+
// ignore, defaults to iconv-lite on error
|
|
61
|
+
}
|
|
47
62
|
}
|
|
48
63
|
|
|
49
64
|
return iconv.decode(buf, fromCharset);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libmime",
|
|
3
3
|
"description": "Encode and decode quoted printable and base64 strings",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.1",
|
|
5
5
|
"main": "lib/libmime",
|
|
6
6
|
"homepage": "https://github.com/andris9/libmime",
|
|
7
7
|
"repository": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"test": "grunt"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"encoding-japanese": "1.0.30",
|
|
22
23
|
"iconv-lite": "0.5.0",
|
|
23
|
-
"jconv": "^0.1.5",
|
|
24
24
|
"libbase64": "1.2.1",
|
|
25
25
|
"libqp": "1.1.0"
|
|
26
26
|
},
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"grunt-cli": "1.3.2",
|
|
33
33
|
"grunt-eslint": "22.0.0",
|
|
34
34
|
"grunt-mocha-test": "0.13.3",
|
|
35
|
-
"iconv": "
|
|
35
|
+
"iconv": "2.3.5",
|
|
36
36
|
"mocha": "6.2.2"
|
|
37
37
|
}
|
|
38
38
|
}
|