Parser: support optional language in mime encoded words (RFC2231)

fork
Brian White 11 years ago
parent 44ab3b81f7
commit 6cdb81bd29

@ -20,9 +20,9 @@ var CH_LF = 10,
RE_CONTINUE = /^\+(?: (?:\[([^\]]+)\] )?(.+))?$/i,
RE_CRLF = /\r\n/g,
RE_HDR = /^([^:]+):[ \t]?(.+)?$/,
RE_ENCWORD = /=\?([^?]*?)\?([qb])\?(.*?)\?=/gi,
RE_ENCWORD_END = /=\?([^?]*?)\?([qb])\?(.*?)\?=$/i,
RE_ENCWORD_BEGIN = /^[ \t]=\?([^?]*?)\?([qb])\?(.*?)\?=/i,
RE_ENCWORD = /=\?([^?*]*?)(?:\*.*?)?\?([qb])\?(.*?)\?=/gi,
RE_ENCWORD_END = /=\?([^?*]*?)(?:\*.*?)?\?([qb])\?(.*?)\?=$/i,
RE_ENCWORD_BEGIN = /^[ \t]=\?([^?*]*?)(?:\*.*?)?\?([qb])\?(.*?)\?=/i,
RE_QENC = /(?:=([a-fA-F0-9]{2}))|_/g,
RE_SEARCH_MODSEQ = /^(.+) \(MODSEQ (.+?)\)$/i,
RE_LWS_ONLY = /^[ \t]*$/;

@ -20,6 +20,14 @@ var CRLF = '\r\n';
expected: { subject: [ '¡Hola, señor!' ] },
what: 'MIME encoded-word in value'
},
{ source: ['Subject: =?iso-8859-1*es?Q?=A1Hola,_se=F1or!?=', CRLF],
expected: { subject: [ '¡Hola, señor!' ] },
what: 'MIME encoded-word in value with language set (RFC2231)'
},
{ source: ['Subject: =?iso-8859-1*?Q?=A1Hola,_se=F1or!?=', CRLF],
expected: { subject: [ '¡Hola, señor!' ] },
what: 'MIME encoded-word in value with empty language set'
},
{ source: ['Subject: =?GB2312?Q?=B2=E2=CA=D4=CC=E2=C4=BF=D3=EB=D6=D0=B9=FA=D0=C5_long_subjects_are_not_OK_12?=', CRLF,
' =?GB2312?Q?345678901234567890123456789012345678901234567890123456789012?=', CRLF,
' =?GB2312?Q?345678901234567890?=', CRLF],

Loading…
Cancel
Save