Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/iconv-lite/encodings/utf7.js')
-rw-r--r--node_modules/iconv-lite/encodings/utf7.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/node_modules/iconv-lite/encodings/utf7.js b/node_modules/iconv-lite/encodings/utf7.js
index b7631c23a..eacae34d5 100644
--- a/node_modules/iconv-lite/encodings/utf7.js
+++ b/node_modules/iconv-lite/encodings/utf7.js
@@ -74,7 +74,7 @@ Utf7Decoder.prototype.write = function(buf) {
if (i == lastI && buf[i] == minusChar) {// "+-" -> "+"
res += "+";
} else {
- var b64str = base64Accum + buf.slice(lastI, i).toString();
+ var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i), "ascii");
res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
}
@@ -91,7 +91,7 @@ Utf7Decoder.prototype.write = function(buf) {
if (!inBase64) {
res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars.
} else {
- var b64str = base64Accum + buf.slice(lastI).toString();
+ var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii");
var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.
@@ -245,7 +245,7 @@ Utf7IMAPDecoder.prototype.write = function(buf) {
if (i == lastI && buf[i] == minusChar) { // "&-" -> "&"
res += "&";
} else {
- var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/');
+ var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i), "ascii").replace(/,/g, '/');
res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
}
@@ -262,7 +262,7 @@ Utf7IMAPDecoder.prototype.write = function(buf) {
if (!inBase64) {
res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars.
} else {
- var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/');
+ var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii").replace(/,/g, '/');
var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.