["test \ntest\n\t \t \n" => "test=20=20\ntest\n=09=20=09=20\n"],
# "=" is special an should be decoded
- ["=\n" => "=3D\n"],
- ["\0\xff" => "=00=FF"],
+ ["=30\n" => "=3D30\n"],
+ ["\0\xff0" => "=00=FF0"],
# Very long lines should be broken (not more than 76 chars
["The Quoted-Printable encoding is intended to represent data that largly consists of octets that correspond to printable characters in the ASCII character set." =>
["$x70!234" => "$x70!234"],
["$x70!2345" => "$x70!2345"],
["$x70!23456" => "$x70!23456"],
+ ["$x70!234567" => "$x70!2345=\n67"],
+ ["$x70!23456=" => "$x70!2345=\n6=3D"],
["$x70!23\n" => "$x70!23\n"],
["$x70!234\n" => "$x70!234\n"],
["$x70!2345\n" => "$x70!2345\n"],
["$x70!23456\n" => "$x70!23456\n"],
+ ["$x70!234567\n" => "$x70!2345=\n67\n"],
+ ["$x70!23456=\n" => "$x70!2345=\n6=3D\n"],
# Not allowed to break =XX escapes using soft line break
- ["$x70===xxxx" => "$x70=3D=\n=3D=3Dxxxx"],
- ["$x70!===xxx" => "$x70!=3D=\n=3D=3Dxxx"],
- ["$x70!!===xx" => "$x70!!=3D=\n=3D=3Dxx"],
- ["$x70!!!===x" => "$x70!!!=\n=3D=3D=3Dx"],
- # ^
- # 70123456|
- # max
- # line width
+ ["$x70===xxxxx" => "$x70=3D=\n=3D=3Dxxxxx"],
+ ["$x70!===xxxx" => "$x70!=3D=\n=3D=3Dxxxx"],
+ ["$x70!2===xxx" => "$x70!2=3D=\n=3D=3Dxxx"],
+ ["$x70!23===xx" => "$x70!23=\n=3D=3D=3Dxx"],
+ ["$x70!234===x" => "$x70!234=\n=3D=3D=3Dx"],
+ ["$x70!2=\n" => "$x70!2=3D\n"],
+ ["$x70!23=\n" => "$x70!23=\n=3D\n"],
+ ["$x70!234=\n" => "$x70!234=\n=3D\n"],
+ ["$x70!2345=\n" => "$x70!2345=\n=3D\n"],
+ ["$x70!23456=\n" => "$x70!2345=\n6=3D\n"],
+ # ^
+ # 70123456|
+ # max
+ # line width
+
+ # some extra special cases we have had problems with
+ ["$x70!2=x=x" => "$x70!2=3D=\nx=3Dx"],
+ ["$x70!2345$x70!2345$x70!23456\n", "$x70!2345=\n$x70!2345=\n$x70!23456\n"],
);
$notests = @tests + 3;
# Same test but with "\r\n" terminated lines
print "not " unless decode_qp("foo \r\n\r\nfoo =\r\n\r\nfoo=20\r\n\r\n") eq
- "foo\r\n\r\nfoo \r\nfoo \r\n\r\n";
+ "foo\n\nfoo \nfoo \n\n";
$testno++; print "ok $testno\n";
-print "not " if $] >= 5.006 && (eval 'encode_qp("XXX \x{100}")' || $@ !~ /^The Quoted-Printable encoding is only defined for bytes/);
+print "not " if $] >= 5.006 && (eval 'encode_qp("XXX \x{100}")' || !$@);
$testno++; print "ok $testno\n";