From f7ddb6760e64c3d46986235dd51ac322046ad51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=8B=E6=99=93=E7=82=9C=20Amio=20/?= Date: Mon, 23 Mar 2020 15:17:04 +0800 Subject: [PATCH] deps: iconv-lite@0.5.2 closes #67 --- HISTORY.md | 3 +++ package.json | 2 +- test/index.js | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index c5b022c7..8945b324 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,9 @@ === * Drop support for Node.js 0.8 + * deps: iconv-lite@0.5.2 + - Add encoding cp720 + - Add encoding UTF-32 2.5.2 / 2023-02-21 ================== diff --git a/package.json b/package.json index aabb1c36..5429a8cf 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", - "iconv-lite": "0.4.24", + "iconv-lite": "0.5.2", "unpipe": "1.0.0" }, "devDependencies": { diff --git a/test/index.js b/test/index.js index de1fc904..856158d7 100644 --- a/test/index.js +++ b/test/index.js @@ -398,6 +398,28 @@ describe('Raw Body', function () { }) }) + it('should decode UTF-32 string (LE BOM)', function (done) { + // BOM makes this LE + var stream = createStream(Buffer.from('fffe0000bf00000043000000f30000006d0000006f00000020000000650000007300000074000000e1000000730000003f000000', 'hex')) + var string = '¿Cómo estás?' + getRawBody(stream, 'utf-32', function (err, str) { + assert.ifError(err) + assert.strictEqual(str, string) + done() + }) + }) + + it('should decode UTF-32 string (BE BOM)', function (done) { + // BOM makes this BE + var stream = createStream(Buffer.from('0000feff000000bf00000043000000f30000006d0000006f00000020000000650000007300000074000000e1000000730000003f', 'hex')) + var string = '¿Cómo estás?' + getRawBody(stream, 'utf-32', function (err, str) { + assert.ifError(err) + assert.strictEqual(str, string) + done() + }) + }) + it('should correctly calculate the expected length', function (done) { var stream = createStream(Buffer.from('{"test":"å"}'))