;separate-sticked-comment ; violate policy preserving absence of space
;separate-sticked-special ; violate policy preserving absence of space
;zero-characters-encoded-word-hack ; violate common sense (very tricky)
+;quoted-encoded-word ; violate character sequence semantics
;;; test driver for FLIM-FLAM (and FLIM)
(let ((result (buffer-substring (point-min) (point))))
(if (member result dsts) t result))))
+;;;start-test;;;
+
;;; from RFC2047
(decode
"Subject: =?ISO-2022-JP?B??=")
(decode
-"Subject: =?ISO-2022-JP?B?DQoNCg==?="
-"Subject: ")
-
-(decode
-"Subject: =?US-ASCII?Q?a=0D=0A_b?="
-"Subject: a b")
-; FLIM-FLAM
-
-(decode
"Subject: =?ISO-2022-JP?B?GyRCJCIbKEI=?= a
=?ISO-2022-JP?B?GyRCJCQbKEI=?="
"Subject: \e$B$"\e(B a \e$B$$\e(B")
"Subject: =?ISO-8859-7?Q?=C3?= =?ISO-2022-JP?B?GyRCNFg/dBsoQg==?="
"Subject: \e.F\eNC\e$B4X?t\e(B")\e*B
+(decode
+"Subject: =?Shift_JIS?B?gqA=?="
+"Subject: \e$B$"\e(B"
+'quoted-encoded-word)
+
+(decode
+"Subject: =?EUC-JP?B?pKI=?="
+"Subject: \e$B$"\e(B"
+'quoted-encoded-word)
+
+;;; quoted-encoded-word \e$BI=8=\e(B
+;
+; RFC2047 \e$B$N%G%3!<%@$O@x:_E*$K\e(B(\e$B%G%3!<%I7k2L$G$J$/\e(B) encoded-word \e$B$=$N$b$N$r\e(B
+; \e$B=PNO$7$J$1$l$P$J$i$J$$$3$H$,$"$k!#\e(B
+;
+; 1. \e$BCN$i$J$$\e(B charset \e$B$b$7$/$O\e(B encoding \e$B$,;XDj$5$l$F$$$?$H$-!#\e(B
+; =?unknown-charset?known-encoding?some-encoded-text?=
+; =?known-charset?unknown-encoding?some-encoded-text?=
+; =?unknown-charset?unknown-encoding?some-encoded-text?=
+;
+; 2. \e$B%G%3!<%I$G$-$F$bFbMF$,7uF]$9$.$k$H$-!#\e(B
+; Non ASCII \e$B3HD%\e(B RFC822 \e$B$NCf$K\e(B =?US-ASCII?Q?=0D=0A=0D=0A?= \e$B$N%G%3!<%I\e(B
+; \e$B7k2L$rKd$a9~$`$N$O4m81$9$.$k!#\e(B
+;
+; \e$B$^$?!"%G%3!<%@$O\e(B encoded-word \e$B$N$h$&$K$_$($k%G%3!<%I7k2L$r=PNO$7$J$1\e(B
+; \e$B$l$P$J$i$J$$$3$H$b$"$k!#\e(B
+;
+; =?US-ASCII?Q?=3D=3FUS-ASCII=3FQ=3Ftext=3F=3D?=
+;
+; \e$B%G%3!<%@$,C1$J$kJ8;zNs$r=PNO$9$k>l9g!"C1=c$K$d$k$H\e(B encoded-word \e$B$=$N$b$N$H\e(B
+; encoded-word \e$B$r6hJL$G$-$J$$!#\e(B
+; \e$B$3$3$G$OJ8;zNsCf$G$=$l$i$r3N<B$K6hJL$7$FI=8=$9$kJ}K!$r<($9!#\e(B
+;
+; rule 1: \e$BJ8;zNsCf$G\e(B =?charset?encoding?text?= \e$B$H$$$&%Q%?!<%s$K\e(B
+; \e$B%^%C%A$7$J$$ItJ,$O$=$NItJ,$N$^$^$NFbMF$rI=$9!#\e(B
+;
+; rule 2: \e$BJ8;zNsCf$G\e(B =?charset?encoding?text?= \e$B$H$$$&%Q%?!<%s$K\e(B
+; \e$B%^%C%A$9$kItJ,$O\e(B charset \e$B$N@hF,$K\e(B '*' \e$B$,$$$/$DIU$$$F$$$k$+$GFbMF$N\e(B
+; \e$B2r<a$rJQ$($k!#\e(B
+;
+; \e$B6v?t$N>l9g\e(B(0, 2, 4, ...): charset \e$B$N@hF,$N\e(B '*' \e$B$N?t$rH>J,$K$7$?J8;zNs\e(B
+; \e$B4q?t$N>l9g\e(B(1, 3, 5, ...): charset \e$B$N@hF,$N\e(B '*' \e$B$N?t$rH>J,\e(B(\e$B>.?tE@0J2<\e(B
+; \e$B@Z<N$F\e(B)\e$B$K$7$F!"$=$l$r\e(B encoded-word \e$B$H;W$C$F%G%3!<%I$7$?J8;zNs!#\e(B
+;
+; NOTE: '*' \e$B$r\e(B quoted-encoded-word \e$BI=8=$N\e(B quote \e$BJ8;z$H8F$V!#\e(B
+;
+; NOTE: \e$B8=;~E@$G\e(B IANA \e$B$N%l%8%9%H%j$K$O\e(B '*' \e$B$r4^$`\e(B charset \e$B$O\e(B
+; \e$BEPO?$5$l$F$$$J$$$N$G!"EPO?$5$l$F$$$k\e(B charset \e$B$r;H$C$?\e(B encoded-word \e$B$r\e(B
+; \e$BI=8=$9$k$K$O\e(B '*' \e$B$r\e(B 1\e$B$D$D$1$k$3$H$K$J$k!#\e(B
+;
+; =?US-ASCII?Q?abcdef?= \e$B$H$$$&\e(Bencoded-word : =?*US-ASCII?Q?abcdef?=
+;
+; =?US-ASCII?Q?abcdef?= \e$B$H$$$&J8;zNs\e(B : =?US-ASCII?Q?abcdef?=
+; =?*US-ASCII?Q?abcdef?= \e$B$H$$$&J8;zNs\e(B : =?**US-ASCII?Q?abcdef?=
+; =?**US-ASCII?Q?abcdef?= \e$B$H$$$&J8;zNs\e(B : =?****US-ASCII?Q?abcdef?=
+; =?***US-ASCII?Q?abcdef?= \e$B$H$$$&J8;zNs\e(B : =?******US-ASCII?Q?abcdef?=
+;
+; rule 3: \e$BJ8;zNsA4BN$NFbMF$O!"\e(Brule 1 \e$B$H\e(B rule 2 \e$B$G2r<a$7$?3FItJ,$N\e(B
+; \e$BJ8;zNs$rC1=c$KO"7k$7$?J8;zNs$H$9$k!#\e(B
+;
+; NOTE: RFC2047 \e$B$G$O\e(B encoded-word \e$B$,6uGr$G6h@Z$i$l$J$1$l$P$J$i$J$$$H$+!"\e(B
+; encoded-word \e$B$,4^$^$l$k9T$O\e(B 76bytes \e$B0J2<$G$J$1$l$P$J$i$J$$$J$I$H$$$&\e(B
+; \e$B5,Ls$,$"$k$,!"\e(Bquoted-encoded-word \e$BI=8=$G$O$=$l$i$O:NMQ$7$J$$!#\e(B
+; \e$BC1=c$K\e(B encoded-word \e$BFbIt$NJ8K!$@$1$rMxMQ$9$k!#\e(B
+; (\e$BK\<AE*$K$O0[$J$kJ8K!$r:NMQ$9$k$3$H$b2DG=$G$"$k!#\e(B)
+;
+; NOTE: quoted-encoded-word \e$BI=8=$7$?J8;zNs$NO"7k$O0BA4$G$O$J$$!#\e(B
+; =?*US-ASCII?Q?ab \e$B$H\e(B cd?= \e$B$H$$$&\e(B quoted-encoded-word \e$BI=8=$7$?J8;zNs$O\e(B
+; \e$B$=$l$>$l$=$NJ8;zNs$=$N$b$N$rI=8=$9$k$,!"$=$l$i$rO"7k$7$?J8;zNs\e(B
+; =?*US-ASCII?Q?abcd?= \e$B$O\e(B abcd \e$B$H$$$&J8;zNs$rI=8=$9$k$3$H$K$J$j!"\e(B
+; \e$B$=$l$>$l$NFbMF$NO"7k$H$O$J$i$J$$!#\e(B
+;
+; \e$B$3$l$O$H$/$K\e(B Non ASCII \e$B3HD%\e(B RFC822 \e$B$NCf$K\e(B quoted-encoded-word \e$BI=8=$r\e(B
+; \e$BKd$a9~$`$H$-$K5$$rIU$1$J$1$l$P$J$i$J$$!#\e(B(\e$BKd$a9~$s$@7k2L$O@5$7$$\e(B
+; quoted-encoded-word \e$BI=8=$H$O$J$i$J$$$+$bCN$l$J$$!#\e(B)
+;
+
+(decode
+"Subject: =?Unknown-Charset?B?gqA=?="
+"Subject: =?*Unknown-Charset?B?gqA=?="
+'quoted-encoded-word)
+; FLIM-FLAM
+
+(decode
+"Subject: =?Unknown-Charset?B?gqA=?= =?Unknown-Charset?B?gqA=?="
+"Subject: =?*Unknown-Charset?B?gqA=?==?*Unknown-Charset?B?gqA=?="
+'quoted-encoded-word)
+; FLIM-FLAM
+
+(decode
+"Subject: =?Unknown-Charset?B?gqA=?= =?Unknown-Charset?B?gqA=?="
+"Subject: =?*Unknown-Charset?B?gqA=?==?*Unknown-Charset?B?gqA=?="
+'quoted-encoded-word)
+; FLIM-FLAM
+
+(decode
+"Subject: =?Unknown-Charset?B?gqA=?=
+ =?Unknown-Charset?B?gqA=?="
+"Subject: =?*Unknown-Charset?B?gqA=?==?*Unknown-Charset?B?gqA=?="
+'quoted-encoded-word)
+; FLIM-FLAM
+
+(decode
+"Subject: =?Unknown-Charset?B?gqA=?=
+ =?Unknown-Charset?B?gqA=?="
+"Subject: =?*Unknown-Charset?B?gqA=?==?*Unknown-Charset?B?gqA=?="
+'quoted-encoded-word)
+; FLIM-FLAM
+
+(decode
+"Subject: a=?Unknown-Charset?B?gqA=?="
+"Subject: a=?Unknown-Charset?B?gqA=?="
+'quoted-encoded-word)
+; FLIM-FLAM
+
+(decode
+"Subject: =?Unknown-Charset?B?gqA=?=b"
+"Subject: =?Unknown-Charset?B?gqA=?=b"
+'quoted-encoded-word)
+; FLIM-FLAM
+
+(decode
+"Subject: a=?Unknown-Charset?B?gqA=?=b"
+"Subject: a=?Unknown-Charset?B?gqA=?=b"
+'quoted-encoded-word)
+; FLIM-FLAM
+
+(decode
+"Subject: a =?Unknown-Charset?B?gqA=?= b"
+"Subject: a =?*Unknown-Charset?B?gqA=?= b"
+'quoted-encoded-word)
+; FLIM-FLAM
+
+(decode
+"Subject: =?ISO-2022-JP?B?DQoNCg==?="
+"Subject: =?*US-ASCII?Q?=0D=0A=0D=0A?="
+'quoted-encoded-word)
+; FLIM-FLAM
+
+(decode
+"Subject: =?US-ASCII?Q?a=0D=0A_b?="
+"Subject: a=?*US-ASCII?Q?=0D=0A?= b"
+'quoted-encoded-word)
+; FLIM-FLAM
+
+;;;end-test;;;
+
;----------------------------------------------------------------------------