iconv-lite
Advanced tools
@@ -112,2 +112,4 @@ "use strict" | ||
| hebrew8: "iso88598", | ||
| iso88598i: "iso88598", | ||
| iso88598e: "iso88598", | ||
@@ -114,0 +116,0 @@ turkish: "iso88599", |
+10
-3
@@ -34,3 +34,5 @@ "use strict" | ||
| var src = Buffer.from(str, "ucs2") | ||
| var dst = Buffer.alloc(src.length * 2) | ||
| // src.length * 2 covers this chunk's code units (4 bytes each); the extra 4 bytes leave room for a | ||
| // high surrogate held over from a previous chunk, which is flushed ahead of this chunk's units. | ||
| var dst = Buffer.alloc(src.length * 2 + 4) | ||
| var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE | ||
@@ -117,5 +119,5 @@ var offset = 0 | ||
| if (isLE) { | ||
| codepoint = overflow[i] | (overflow[i + 1] << 8) | (overflow[i + 2] << 16) | (overflow[i + 3] << 24) | ||
| codepoint = overflow[0] | (overflow[1] << 8) | (overflow[2] << 16) | (overflow[3] << 24) | ||
| } else { | ||
| codepoint = overflow[i + 3] | (overflow[i + 2] << 8) | (overflow[i + 1] << 16) | (overflow[i] << 24) | ||
| codepoint = overflow[3] | (overflow[2] << 8) | (overflow[1] << 16) | (overflow[0] << 24) | ||
| } | ||
@@ -174,3 +176,8 @@ overflow.length = 0 | ||
| Utf32Decoder.prototype.end = function () { | ||
| if (this.overflow.length === 0) { return } | ||
| // A leftover, incomplete 4-byte code unit at the end of the input is ill-formed. Substitute a | ||
| // single U+FFFD (Unicode Standard conformance clause C10) instead of silently dropping the bytes. | ||
| this.overflow.length = 0 | ||
| return String.fromCharCode(this.badChar) | ||
| } | ||
@@ -177,0 +184,0 @@ |
+2
-2
| { | ||
| "name": "iconv-lite", | ||
| "description": "Convert character encodings in pure javascript.", | ||
| "version": "0.7.2", | ||
| "version": "0.7.3", | ||
| "license": "MIT", | ||
@@ -49,3 +49,3 @@ "keywords": [ | ||
| "devDependencies": { | ||
| "@arethetypeswrong/cli": "^0.17.4", | ||
| "@arethetypeswrong/cli": "^0.18.4", | ||
| "@stylistic/eslint-plugin": "^5.1.0", | ||
@@ -52,0 +52,0 @@ "@stylistic/eslint-plugin-js": "^4.1.0", |
@@ -279,2 +279,4 @@ /* | ||
| | "iso88598" | ||
| | "iso88598e" | ||
| | "iso88598i" | ||
| | "iso88599" | ||
@@ -281,0 +283,0 @@ | "isoceltic" |
344185
0.16%4620
0.22%