Skip to content

Commit 5729fca

Browse files
committed
Unit test for #35 Base64 encoded Japanese character not decoded as expected
Fixed in 2fe1c21.
1 parent 833c619 commit 5729fca

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/mimeparser-unit.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,23 @@ describe('Body parsing', () => {
141141
expect(new TextDecoder('utf-8').decode(root.content)).to.equal('━━━━━━━━━\n本メールは、マイナ�')
142142
})
143143

144+
it('should parse UTF-8 encoded body with Base64 transfer encoding', function () {
145+
var fixture = 'Mime-Version: 1.0\r\n' +
146+
'Content-Type: text/plain; charset=UTF-8\r\n' +
147+
'Content-Transfer-Encoding: base64\r\n' +
148+
'\r\n' +
149+
'CuKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKU\r\n' +
150+
'geKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKUgeKU\r\n' +
151+
'geKUgeKUgQoK44CA44CA44CA44CA44CA44CA44CAWWFob28h44Kr44O844OJ\r\n' +
152+
'44CA44GK44GZ44GZ44KB5oOF5aCx44Oh44O844Or\r\n'
153+
const root = parse(fixture)
154+
expect(new TextDecoder('utf-8').decode(root.content)).to.equal(
155+
'\n' +
156+
'━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' +
157+
'\n' +
158+
'       Yahoo!カード おすすめ情報メール')
159+
})
160+
144161
it('should decode latin-1 quoted-printable', function () {
145162
var fixture = 'Content-Type: text/plain; charset="latin_1"\r\n' +
146163
'Content-Transfer-Encoding: quoted-printable\r\n' +

0 commit comments

Comments
 (0)