Skip to content

Commit

Permalink
Unit test for #35 Base64 encoded Japanese character not decoded as ex…
Browse files Browse the repository at this point in the history
…pected

Fixed in 2fe1c21.
  • Loading branch information
nifgraup committed Jun 6, 2019
1 parent 833c619 commit 5729fca
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/mimeparser-unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,23 @@ describe('Body parsing', () => {
expect(new TextDecoder('utf-8').decode(root.content)).to.equal('━━━━━━━━━\n本メールは、マイナ�')
})

it('should parse UTF-8 encoded body with Base64 transfer encoding', function () {
var fixture = 'Mime-Version: 1.0\r\n' +
'Content-Type: text/plain; charset=UTF-8\r\n' +
'Content-Transfer-Encoding: base64\r\n' +
'\r\n' +
'CuKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKU\r\n' +
'geKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKU\r\n' +
'geKUgeKUgQoK44CA44CA44CA44CA44CA44CA44CAWWFob28h44Kr44O844OJ\r\n' +
'44CA44GK44GZ44GZ44KB5oOF5aCx44Oh44O844Or\r\n'
const root = parse(fixture)
expect(new TextDecoder('utf-8').decode(root.content)).to.equal(
'\n' +
'━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' +
'\n' +
'       Yahoo!カード おすすめ情報メール')
})

it('should decode latin-1 quoted-printable', function () {
var fixture = 'Content-Type: text/plain; charset="latin_1"\r\n' +
'Content-Transfer-Encoding: quoted-printable\r\n' +
Expand Down

0 comments on commit 5729fca

Please sign in to comment.