Closed gene-hightower closed 2 years ago
I suspect that Buffers and strings should encode the same way. A few new tests will fail:
diff --git a/test/utils.js b/test/utils.js index 73dfb55..5be73f9 100644 --- a/test/utils.js +++ b/test/utils.js @@ -38,6 +38,13 @@ describe('encode_qp', function () { done(); }) + it('plain ascii should not be encoded in Buffers', function (done) { + assert.equal( + utils.encode_qp(Buffer.from('quoted printable')), + 'quoted printable'); + done(); + }) + it('8-bit chars should be encoded', function (done) { assert.equal( utils.encode_qp( @@ -47,20 +54,29 @@ describe('encode_qp', function () { done(); }) + it('8-bit chars should be encoded in Buffers', function (done) { + assert.equal( + utils.encode_qp( + Buffer.from('v\xe5re kj\xe6re norske tegn b\xf8r \xe6res') + ), + 'v=C3=A5re kj=C3=A6re norske tegn b=C3=B8r =C3=A6res'); + done(); + }) +
I suspect that Buffers and strings should encode the same way. A few new tests will fail: