;-------- This sequece of HYPHEN-MINUS is 76 bytes long. --------------------
;----------------------------------------------------------------------------
-; options:
-;encode-sticked-comment-as-atom ; violate the policy preserving structures
-;ignore-75bytes-limit ; violate RFC2047
-;ignore-76bytes-limit ; violate RFC2047
-;permit-sticked-comment ; violate RFC2047
-;permit-sticked-special ; violate RFC2047
-;separate-sticked-comment ; violate the policy preserving absence of space
-;separate-sticked-special ; violate the policy preserving absence of space
-;zero-characters-encoded-word-hack ; violate common sense (very tricky)
-;quoted-encoded-word ; violate character sequence semantics
-;separate-sticked-tokens-for-fold ; violate the policy preserving absence of space
-;encode-long-ascii-string-for-fold ; violate the policy preserving US-ASCII string
-;divide-atom-for-fold ; violate tne policy preserving absence of space
+;;; options:
+;;encode-sticked-comment-as-atom ; violate the policy preserving structures
+;;ignore-75bytes-limit ; violate RFC2047
+;;ignore-76bytes-limit ; violate RFC2047
+;;permit-sticked-comment ; violate RFC2047
+;;permit-sticked-special ; violate RFC2047
+;;separate-sticked-comment ; violate the policy preserving absence of space
+;;separate-sticked-special ; violate the policy preserving absence of space
+;;zero-characters-encoded-word-hack ; violate common sense (very tricky)
+;;quoted-encoded-word ; violate character sequence semantics
+;;separate-sticked-tokens-for-fold ; violate the policy preserving absence of space
+;;encode-long-ascii-string-for-fold ; violate the policy preserving US-ASCII string
+;;divide-atom-for-fold ; violate tne policy preserving absence of space
;;; test driver
(setq encode-all-count 0)
(defun encode (src dsts &rest opts)
(if (stringp dsts) (setq dsts (list dsts)))
- (setq encode-all-count (1+ decode-all-count))
+ (setq encode-all-count (1+ encode-all-count))
(let ((res (condition-case nil
(apply encode-test src dsts opts)
(error nil))))
;;; FLAM specific part (FLIM is OK)
+(if (< max-specpdl-size 1000)
+ (setq max-specpdl-size 1000))
+
(defun decode-flam (src dsts &rest opts)
(setq eword-lexical-analyze-cache nil)
(setq eword-decode-sticked-encoded-word
(let ((result (buffer-substring (point-min) (point))))
(if (member result dsts) t result))))
-;;;start-test;;;
+;;;start-test
-;; Section 1: Decoding examples from RFC2047
+;;; Section 1: Decoding examples from RFC2047
(decode
"From: =?US-ASCII?Q?Keith_Moore?= <moore@cs.utk.edu>"
"Subject: (=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=)"
"Subject: (=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=)")
-;; Section 2: Decoding proper inputs.
+;;; Section 2: Decoding proper inputs.
(decode
"From: =?ISO-2022-JP?B?GyRCJCIbKEI=?= <akr@jaist.ac.jp>"
"From: \e$B$"$$\e(B <akr@jaist.ac.jp>")
(decode
+"From: =?ISO-2022-JP?B?GyRCJCIbKEI=?= \"ja \\\"a\\\"\" <akr@jaist.ac.jp>"
+"From: \e$B$"\e(B \"ja \\\"a\\\"\" <akr@jaist.ac.jp>")
+
+(decode
"From: akr@jaist.ac.jp (=?ISO-2022-JP?B?GyRCJCIbKEI=?=
=?ISO-2022-JP?B?GyhC?=(=?ISO-2022-JP?B?GyRCJCQbKEI=?=
=?ISO-2022-JP?B?GyhC?=)=?ISO-2022-JP?B?GyRCJCYbKEI=?=)"
"=?ISO-2022-JP?B?GyRCJCIbKEI=?=: test"
'permit-sticked-special)
-;; Section 3: Decoding melancholic inputs.
+;;; Section 3: Decoding melancholic inputs.
(decode
"From:=?ISO-2022-JP?B?GyRCJCIbKEI=?= <akr@jaist.ac.jp>"
"Subject:\e$B$"\e(B"
'permit-sticked-special)
-;; Section 4: Decoding invalid inputs.
+;;; Section 4: Decoding invalid inputs.
(decode
"From: =?ISO-2022-JP?B?GyRCJCIbKEI=?==?ISO-2022-JP?B?GyRCJCQbKEI=?=
"Subject: =?ISO-2022-JP?B?GyRCNFg-dBsoQg==?="
"Subject: =?ISO-2022-JP?B?GyRCNFg-dBsoQg==?=")
-;; Section 5: Encoding proper inputs.
+;;; Section 5: Encoding proper inputs.
(encode
"From: \e$B$"\e(B <akr@jaist.ac.jp>"
"From: =?ISO-2022-JP?B?GyRCJCIbKEIgGyRCJCQbKEI=?= <akr@jaist.ac.jp>")
(encode
+"From: \e.A\eN! \eN! <akr@jaist.ac.jp>"\e*B
+"From: =?ISO-8859-1?Q?=A1_=A1?= <akr@jaist.ac.jp>")
+
+(encode
"From: \"\e$B$"\e(B(\e$B$"\e(B)\" <akr@jaist.ac.jp>"
"From: =?ISO-2022-JP?B?GyRCJCIbKEIoGyRCJCIbKEIp?= <akr@jaist.ac.jp>")
=?US-ASCII?Q?a?=(=?ISO-2022-JP?B?GyRCJCIbKEI=?=)aa <akr@jaist.ac.jp>"
'encode-long-ascii-string-for-fold)
-;; Section 6: Encoding melancholic inputs.
+(encode
+"From: \e$B$"\e(B aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\e$B$"\e(B)aa <akr@jaist.ac.jp>"
+"From: =?ISO-2022-JP?B?GyRCJCIbKEIgYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ==?=
+ =?US-ASCII?Q?aaaaaaaaaaaaaaa?=(=?ISO-2022-JP?B?GyRCJCIbKEI=?=)aa"
+'encode-long-ascii-string-for-fold)
+
+(encode
+"From: (\e$B$"\e(B) <akr@jaist.ac.jp>"
+"From: (=?ISO-2022-JP?B?GyRCJCIbKEI=?=) <akr@jaist.ac.jp>")
+
+(encode
+"From: ((((((((((((((((((((((((((((((((((((((((\e$B$"\e(B)))))))))))))))))))))))))))))))))))))))) <akr@jaist.ac.jp>"
+"From: ((((((((((((((((((((((((((((((((((((((((=?ISO-2022-JP?B?GyRCJCIbKEI=?=
+ =?ISO-2022-JP?B?GyhC?=))))))))))))))))))))))))))))))))))))))))
+ <akr@jaist.ac.jp>"
+'zero-characters-encoded-word-hack)
+
+(encode
+"From: (((((((((((((((((((((((((((((((((((((((((\e$B$"\e(B))))))))))))))))))))))))))))))))))))))))) <akr@jaist.ac.jp>"
+"From: (((((((((((((((((((((((((((((((((((((((((=?ISO-2022-JP?B?GyhC?=
+ =?ISO-2022-JP?B?GyRCJCIbKEI=?=)))))))))))))))))))))))))))))))))))))))))
+ <akr@jaist.ac.jp>"
+'zero-characters-encoded-word-hack)
+
+(encode
+"From: ((((((((((((((((((((((((((((((((((((((((((((((\e$B$"\e(B)))))))))))))))))))))))))))))))))))))))))))))) <akr@jaist.ac.jp>"
+"From: ((((((((((((((((((((((((((((((((((((((((((((((=?ISO-2022-JP?B?GyhC?=
+ =?ISO-2022-JP?B?GyRCJCIbKEI=?=))))))))))))))))))))))))))))))))))))))))))))))
+ <akr@jaist.ac.jp>"
+'zero-characters-encoded-word-hack)
+
+(encode
+"From: (((((((((((((((((((((((((((((((((((((((((((((((\e$B$"\e(B))))))))))))))))))))))))))))))))))))))))))))))) <akr@jaist.ac.jp>"
+"From: (((((((((((((((((((((((((((((((((((((((((((((((=?ISO-2022-JP?B?GyhC?=
+ =?ISO-2022-JP?B?GyRCJCIbKEI=?=
+ =?ISO-2022-JP?B?GyhC?=)))))))))))))))))))))))))))))))))))))))))))))))
+ <akr@jaist.ac.jp>"
+'zero-characters-encoded-word-hack)
+
+(encode
+"From: ((((((((((((((((((((((((((((((((((((((((((((((((\e$B$"\e(B)))))))))))))))))))))))))))))))))))))))))))))))) <akr@jaist.ac.jp>"
+"From:
+ ((((((((((((((((((((((((((((((((((((((((((((((((=?ISO-2022-JP?B?GyhC?=
+ =?ISO-2022-JP?B?GyRCJCIbKEI=?=
+ =?ISO-2022-JP?B?GyhC?=))))))))))))))))))))))))))))))))))))))))))))))))
+ <akr@jaist.ac.jp>"
+'zero-characters-encoded-word-hack)
+
+(encode
+"From: ((((((((((((((((((((((((((((((((((((((((((((((((((((((\e$B$"\e(B)))))))))))))))))))))))))))))))))))))))))))))))))))))) <akr@jaist.ac.jp>"
+"From:
+ ((((((((((((((((((((((((((((((((((((((((((((((((((((((=?ISO-2022-JP?B?GyhC?=
+ =?ISO-2022-JP?B?GyRCJCIbKEI=?=
+ =?ISO-2022-JP?B?GyhC?=))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ <akr@jaist.ac.jp>"
+'zero-characters-encoded-word-hack)
+
+(encode
+"From: (((((((((((((((((((((((((((((((((((((((((((\e$B$"\e(B))))))))))))))))))))))))))))))))))))))))))) <akr@jaist.ac.jp>"
+"From:
+ ((((((((((((((((((((((((((((((((((((((((((((((((((((((=?ISO-2022-JP?B?GyhC?=
+ =?ISO-2022-JP?B?GyRCJCIbKEI=?=
+ =?ISO-2022-JP?B?GyhC?=))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ <akr@jaist.ac.jp>"
+'zero-characters-encoded-word-hack)
+
+(encode
+"From: (((((((((((((((((((((((((((((((((((((((((((((((((((((((\e$B$"\e(B))))))))))))))))))))))))))))))))))))))))))))))))))))))) <akr@jaist.ac.jp>"
+"From:
+ ((((((((((((((((((((((((((((((((((((((((((((((((((((((=?ISO-2022-JP?B?GyhC?=
+ =?ISO-2022-JP?B?GyhC?=(=?ISO-2022-JP?B?GyRCJCIbKEI=?=)=?ISO-2022-JP?B?GyhC?=
+ =?ISO-2022-JP?B?GyhC?=))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ <akr@jaist.ac.jp>"
+'zero-characters-encoded-word-hack)
+
+(encode
+"From: ((((((((((((((((((((((((((((((((((((((((((((((((((((((((\e$B$"\e(B)))))))))))))))))))))))))))))))))))))))))))))))))))))))) <akr@jaist.ac.jp>"
+"From:
+ ((((((((((((((((((((((((((((((((((((((((((((((((((((((=?ISO-2022-JP?B?GyhC?=
+ =?ISO-2022-JP?B?GyhC?=((=?ISO-2022-JP?B?GyRCJCIbKEI=?=
+ =?ISO-2022-JP?B?GyhC?=))))))))))))))))))))))))))))))))=?ISO-2022-JP?B?GyhC?=
+ =?ISO-2022-JP?B?GyhC?=))))))))))))))))))))))))
+ <akr@jaist.ac.jp>"
+'zero-characters-encoded-word-hack)
+
+(encode
+"From: ()(\e$B$"\e(B)() <akr@jaist.ac.jp>"
+"From: ()(=?ISO-2022-JP?B?GyRCJCIbKEI=?=)() <akr@jaist.ac.jp>")
+
+(encode
+"From: (\e$B$"\e(B)()()()()()()()()()()()()()()()()()()() <akr@jaist.ac.jp>"
+"From: (=?ISO-2022-JP?B?GyRCJCIbKEI=?=)()()()()()()()()()()()()()()()()()()()
+ <akr@jaist.ac.jp>")
+
+(encode
+"From: (\e$B$"\e(B)()()()()()()()()()()()()()()()()()()()()()() <akr@jaist.ac.jp>"
+"From:
+ (=?ISO-2022-JP?B?GyRCJCIbKEI=?=)()()()()()()()()()()()()()()()()()()()()()()
+ <akr@jaist.ac.jp>")
+
+(encode
+"From: (\e$B$"\e(B)()()()()()()()()()()()()()()()()()()()()()()() <akr@jaist.ac.jp>"
+"From: (=?ISO-2022-JP?B?GyRCJCIbKEI=?=
+ =?ISO-2022-JP?B?GyhC?=)()()()()()()()()()()()()()()()()()()()()()()()
+ <akr@jaist.ac.jp>"
+'zero-characters-encoded-word-hack)
+
+(encode
+"From: (\e$B$"\e(B)()()()()()()()()()()()()()()()()()()()()()()()()()()() <akr@jaist.ac.jp>"
+"From: (=?ISO-2022-JP?B?GyRCJCIbKEI=?=
+ =?ISO-2022-JP?B?GyhC?=)()()()()()()()()()()()()()()()(=?ISO-2022-JP?B?GyhC?=
+ =?ISO-2022-JP?B?GyhC?=)()()()()()()()()()()() <akr@jaist.ac.jp>"
+'zero-characters-encoded-word-hack)
+
+(encode
+"To: l@d (\e$B$"\e(B aaa)(\e$B$"\e(B)"
+"To: l@d (=?ISO-2022-JP?B?GyRCJCIbKEI=?= aaa)(=?ISO-2022-JP?B?GyRCJCIbKEI=?=)")
+
+(encode
+"To: l@d (\e$B$"\e(B aaaa)(\e$B$"\e(B)"
+"To: l@d (=?ISO-2022-JP?B?GyRCJCIbKEI=?=
+ aaaa)(=?ISO-2022-JP?B?GyRCJCIbKEI=?=)")
+
+(encode
+"To: l@d (\e$B$"\e(B aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)(\e$B$"\e(B)"
+"To: l@d (=?ISO-2022-JP?B?GyRCJCIbKEI=?=
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)(=?ISO-2022-JP?B?GyRCJCIbKEI=?=)")
+
+(encode
+"To: l@d (\e$B$"\e(B aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)(\e$B$"\e(B)"
+"To: l@d (=?ISO-2022-JP?B?GyRCJCIbKEIgYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE=?=
+ =?US-ASCII?Q?aaaaaaaaaaaaaaaaaa?=)(=?ISO-2022-JP?B?GyRCJCIbKEI=?=)"
+'encode-long-ascii-string-for-fold)
+
+(encode
+"To: l@d (\e$B$"\e(B aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()\e$B$"\e(B)"
+"To: l@d (=?ISO-2022-JP?B?GyRCJCIbKEIgYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE=?=
+ =?US-ASCII?Q?aaaaaaaaaaaaaaaaaa?=()=?ISO-2022-JP?B?GyRCJCIbKEI=?=)"
+'encode-long-ascii-string-for-fold)
+
+(encode
+"To: l@d (\e$B$"\e(B aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \e$B$"\e(B)(\e$B$"\e(B)"
+"To: l@d (=?ISO-2022-JP?B?GyRCJCIbKEI=?= aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ =?ISO-2022-JP?B?GyRCJCIbKEI=?=)(=?ISO-2022-JP?B?GyRCJCIbKEI=?=)")
+
+(encode
+"To: l@d (\e$B$"\e(B aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \e$B$"\e(B)(\e$B$"\e(B)"
+"To: l@d (=?ISO-2022-JP?B?GyRCJCIbKEI=?=
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ =?ISO-2022-JP?B?GyRCJCIbKEI=?=)(=?ISO-2022-JP?B?GyRCJCIbKEI=?=)")
+
+;----------------------------------------------------------------------------
+
+;;; Section 6: Encoding melancholic inputs.
(encode
"From: akr@jaist.ac.jp (\e$B$"\e(B(\e$B$$\e(B)\e$B$&\e(B)"
=?ISO-2022-JP?B?GyRCJCgbKEI=?= <foo@bar>"
'separate-sticked-special)
-;; Section 7: Using quoted-encoded-words.
-;
+;;; Section 7: Using quoted-encoded-words.
+;;
;; 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$N$h$&$K$_$($kJ8;zNs$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@\e(B(1998/07/19)\e$B$G\e(B IANA \e$B$K$O\e(B + \e$B$r4^$`\e(B charset \e$B$O\e(B
-; \e$BEPO?$5$l$F$$$J$$$N$G!"$=$l$i$N\e(B charset \e$B$r;H$C$?\e(B
-; encoded-word \e$B$rI=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?=
-; =?US-ASCII+?Q?abcdef?= \e$B$H$$$&J8;zNs\e(B : =?US-ASCII+?Q?abcdef?=
-; =?U+S-ASCII?Q?abcdef?= \e$B$H$$$&J8;zNs\e(B : =?U+S-ASCII?Q?abcdef?=
-;
-; NOTE: encoded-word \e$B$K8+$($kJ8;zNs$G\e(B + \e$B$,G\A}$5$l$k$N$O\e(B charset \e$B$N\e(B
-; \e$B@hF,$@$1$G$"$j!"\e(Bencoding \e$B$d\e(B encoded-text \e$B$O$?$H$(\e(B + \e$B$,F~$C$F$$$F$b\e(B
-; \e$BJQ2=$7$J$$!#$^$?!"\e(Bcharset \e$BCf$G$b\e(B \e$B@hF,0J30$N\e(B + \e$B$OJQ2=$7$J$$!#\e(B
-;
-; 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$O\e(B 75bytes \e$B0J2<$G$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(BRFC2047 \e$B$K7I0U$r\e(B
-; \e$BI=$7$F\e(B encoded-word \e$B$NJ8K!$r:NMQ$9$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)
+;;
+;; 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$N$h$&$K$_$($kJ8;zNs$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@\e(B(1998/07/19)\e$B$G\e(B IANA \e$B$K$O\e(B + \e$B$r4^$`\e(B charset \e$B$O\e(B
+;; \e$BEPO?$5$l$F$$$J$$$N$G!"$=$l$i$N\e(B charset \e$B$r;H$C$?\e(B
+;; encoded-word \e$B$rI=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?=
+;; =?US-ASCII+?Q?abcdef?= \e$B$H$$$&J8;zNs\e(B : =?US-ASCII+?Q?abcdef?=
+;; =?U+S-ASCII?Q?abcdef?= \e$B$H$$$&J8;zNs\e(B : =?U+S-ASCII?Q?abcdef?=
+;;
+;; NOTE: encoded-word \e$B$K8+$($kJ8;zNs$G\e(B + \e$B$,G\A}$5$l$k$N$O\e(B charset \e$B$N\e(B
+;; \e$B@hF,$@$1$G$"$j!"\e(Bencoding \e$B$d\e(B encoded-text \e$B$O$?$H$(\e(B + \e$B$,F~$C$F$$$F$b\e(B
+;; \e$BJQ2=$7$J$$!#$^$?!"\e(Bcharset \e$BCf$G$b\e(B \e$B@hF,0J30$N\e(B + \e$B$OJQ2=$7$J$$!#\e(B
+;;
+;; 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$O\e(B 75bytes \e$B0J2<$G$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(BRFC2047 \e$B$K7I0U$r\e(B
+;; \e$BI=$7$F\e(B encoded-word \e$B$NJ8K!$r:NMQ$9$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: a=?+US-ASCII?Q?=0D=0A?=b"
'quoted-encoded-word)
-;;;end-test;;;
+;;;end-test
(report)