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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v4.2.1 2019-10-28
4
+
5
+ - Replace jconv with more recent encoding-japanese
6
+
3
7
  ## v4.2.0 2019-10-28
4
8
 
5
9
  - Use jconv module to parse ISO-2022-JP by default
package/lib/charset.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const iconv = require('iconv-lite');
4
- const jconv = require('jconv');
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
- return jconv.decode(buf, fromCharset);
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.0",
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": "^2.3.5",
35
+ "iconv": "2.3.5",
36
36
  "mocha": "6.2.2"
37
37
  }
38
38
  }