r18560 - in /branches/upstream/libmime-encwords-perl/current: ./ EncWords/ t/ testin/

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Sun Apr 13 12:06:17 UTC 2008


Author: gregoa-guest
Date: Sun Apr 13 12:06:16 2008
New Revision: 18560

URL: http://svn.debian.org/wsvn/?sc=1&rev=18560
Log:
[svn-upgrade] Integrating new upstream version, libmime-encwords-perl (1.010)

Added:
    branches/upstream/libmime-encwords-perl/current/testin/decode-ascii.txt
    branches/upstream/libmime-encwords-perl/current/testin/encode-ascii.txt
Modified:
    branches/upstream/libmime-encwords-perl/current/Changes
    branches/upstream/libmime-encwords-perl/current/EncWords.pm
    branches/upstream/libmime-encwords-perl/current/EncWords/JA_JP.pod
    branches/upstream/libmime-encwords-perl/current/META.yml
    branches/upstream/libmime-encwords-perl/current/Makefile.PL
    branches/upstream/libmime-encwords-perl/current/README
    branches/upstream/libmime-encwords-perl/current/t/01decode.t
    branches/upstream/libmime-encwords-perl/current/t/02encode.t
    branches/upstream/libmime-encwords-perl/current/testin/encode-multibyte.txt
    branches/upstream/libmime-encwords-perl/current/testin/encode-singlebyte.txt

Modified: branches/upstream/libmime-encwords-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/Changes?rev=18560&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/Changes (original)
+++ branches/upstream/libmime-encwords-perl/current/Changes Sun Apr 13 12:06:16 2008
@@ -1,3 +1,21 @@
+2008-04-12	Hatuka*nezumi - IKEDA Soji	<hatuka at nezumi.nu>
+
+	* Release 1.010.
+	* encode_mimeword(): Restrict characters in encoded-words
+	  according to RFC 2047 section 5 (3).
+	  Note: length(encode_mimeword()) may not be equal to
+	  encoded_header_len() of MIME::Charset 1.004 or earlier.
+	* Bug Fix: Texts with ``US-ASCII transformation'' charsets,
+	  HZ-GB-2312 (RFC 1842) and UTF-7 (RFC 2152), were treated
+	  as US-ASCII.
+	* Fix: encoded-words exceeding line length can be generated.
+	* encode_mimewords(): Improved encoding of unsafe ASCII
+	  sequences (words exceeding line length or including ``=?'').
+	* encode_mimeword(): can take charset object argument.
+	  In this case RAW can be Unicode string.
+	* Modified / added tests for multibyte / singlebyte / unsafe
+	  ASCII.
+
 2008-03-30	Hatuka*nezumi - IKEDA Soji	<hatuka at nezumi.nu>
 
 	* Release 1.009.

Modified: branches/upstream/libmime-encwords-perl/current/EncWords.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/EncWords.pm?rev=18560&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/EncWords.pm (original)
+++ branches/upstream/libmime-encwords-perl/current/EncWords.pm Sun Apr 13 12:06:16 2008
@@ -120,7 +120,7 @@
 #------------------------------
 
 ### The package version, both in 1.23 style *and* usable by MakeMaker:
-$VERSION = '1.009';
+$VERSION = '1.010';
 
 ### Public Configuration Attributes
 $Config = {
@@ -142,6 +142,7 @@
 my $NONPRINT = qr{[^$PRINTABLE]}; # Improvement: Unicode support.
 my $UNSAFE = qr{[^\x01-\x20$PRINTABLE]};
 my $WIDECHAR = qr{[^\x00-\xFF]};
+my $ASCIITRANS = qr{^(?:HZ-GB-2312|UTF-7)$}i;
 
 #------------------------------
 
@@ -180,9 +181,9 @@
 #     Improvement by this module: Spaces are escaped by ``_''.
 sub _encode_Q {
     my $str = shift;
-    # $str =~ s{([_\?\=$NONPRINT])}{sprintf("=%02X", ord($1))}eog;
-    $str =~ s{(\x20)|([_?=]|$NONPRINT)}{
-	defined $1? "_": sprintf("=%02X", ord($2))
+    # Restrict characters to those listed in RFC 2047 section 5 (3)
+    $str =~ s{[^-!*+/0-9A-Za-z]}{
+	$& eq "\x20"? "_": sprintf("=%02X", ord($&))
 	}eog;
     $str;
 }
@@ -483,9 +484,17 @@
 sub encode_mimeword {
     my $word = shift;
     my $encoding = uc(shift || 'Q');          # not overridden.
-    my $charset  = uc(shift || 'ISO-8859-1'); # ditto.
+    my $charset  = shift || 'ISO-8859-1';     # ditto.
     my $language = uc(shift || "");	      # ditto.
 
+    if (ref $charset) {
+	if (is_utf8($word) or $word =~ /$WIDECHAR/) {
+	    $word = $charset->undecode($word, 0);
+	}
+	$charset = $charset->as_string;
+    } else {
+	$charset = uc($charset);
+    }
     my $encstr;
     if ($encoding eq 'Q') {
 	$encstr = &_encode_Q($word);
@@ -639,17 +648,16 @@
     my $words = shift;
     my %params = @_;
     my %Params = &_getparams(\%params,
-			     NoDefault => [qw(Charset)], # apply default later
 			     YesNo => [qw(Detect7bit Minimal)],
-			     Others => [qw(Encoding Field Folding Mapping
-					   MaxLineLen Replacement)],
+			     Others => [qw(Charset Encoding Field Folding
+					   Mapping MaxLineLen Replacement)],
 			     ToUpper => [qw(Charset Encoding Mapping
 					    Replacement)],
 			    );
-    # checks
     croak "unsupported encoding ``$Params{Encoding}''"
 	unless $Params{Encoding} =~ /^[ABQS]$/;
-    my ($fwsbrk, $fwsspc);		# Newline and following WSP
+    # newline and following WSP
+    my ($fwsbrk, $fwsspc);
     if ($Params{Folding} =~ m/^([\r\n]*)([\t ]?)$/) {
 	$fwsbrk = $1;
 	$fwsspc = $2 || " ";
@@ -657,90 +665,115 @@
 	croak sprintf "illegal folding sequence ``\\x%*v02X''", '\\x',
 		      $Params{Folding};
     }
-    # calculate some variables
+    # charset objects
     my $charsetobj = MIME::Charset->new($Params{Charset},
 					Mapping => $Params{Mapping});
+    my $ascii = MIME::Charset->new("US-ASCII", Mapping => 'STANDARD');
+    $ascii->encoder($ascii);
+    # lengths
     my $firstlinelen = $Params{MaxLineLen} -
 	($Params{Field}? length("$Params{Field}: "): 0);
     my $maxrestlen = $Params{MaxLineLen} - length($fwsspc);
+    my $UNSAFEASCII = ($maxrestlen <= 1)?
+	qr{(?: =\? )}ox:
+	qr{(?: =\? | [$PRINTABLE]{$Params{MaxLineLen}} )}ox;
 
     unless (ref($words) eq "ARRAY") {
+	my @words = ();
 	# unfolding: normalize linear-white-spaces and orphan newlines.
 	$words =~ s/(?:[\r\n]+[\t ])*[\r\n]+([\t ]|\Z)/$1? " ": ""/eg;
 	$words =~ s/[\r\n]+/ /g;
 	# split if required
 	if ($Params{Minimal} eq "YES") {
-	    my @words = map { [$_, $Params{Charset}] }
-			    split(/((?:\A|[\t ])[\t $PRINTABLE]+(?:[\t ]|\Z))/,
-				  $words);
-	    $words = \@words;
+	    my ($spc, $unsafe_last) = ('', 0);
+	    foreach my $w (split(/([\t ]+)/, $words)) {
+		next unless scalar(@words) or length($w); # skip garbage
+		if ($w =~ /[\t ]/) {
+		    $spc = $w;
+		    next;
+		}
+
+		# workaround for ``ASCII transformation'' charsets
+		my $u = $w;
+		if ($charsetobj->as_string =~ /$ASCIITRANS/ and $u =~ /[+~]/) {
+		    if ($charsetobj->decoder) {
+			$u = $charsetobj->decode($u);
+		    } elsif (!MIME::Charset::USE_ENCODE) { # for pre-Encode env.
+			$u = "X$u";
+		    } else { # NOTREACHED
+			croak __PACKAGE__.": Bug in encode_mimewords";
+		    }
+		}
+		if (scalar(@words)) {
+		    if (($w =~ /$NONPRINT|$UNSAFEASCII/ or $u ne $w) xor
+			$unsafe_last) {
+			if ($unsafe_last) {
+			    push @words, $spc.$w;
+			} else {
+			    $words[-1] .= $spc;
+			    push @words, $w;
+			}
+			$unsafe_last = not $unsafe_last;
+		    } else {
+			$words[-1] .= $spc.$w;
+		    }
+		} else {
+		    push @words, $spc.$w;
+		    $unsafe_last =
+			($w =~ /$NONPRINT|$UNSAFEASCII/ or $u ne $w);
+		}
+		$spc = '';
+	    }
+	    if ($spc) {
+		if (scalar(@words)) {
+		    $words[-1] .= $spc;
+		} else { # only WSPs
+		    push @words, $spc;
+		}
+	    }
 	} else {
-	    $words = [[$words, $Params{Charset}]];
-	}
+	    @words = ($words);
+	}
+	$words = [map { [$_, $Params{Charset}] } @words];
     }
 
     # Translate / concatenate words.
     my @triplets;
     foreach (@$words) {
 	my ($s, $cset) = @$_;
-	my $csetobj = MIME::Charset->new($cset, Mapping => $Params{Mapping});
+	next unless length($s);
+	my $csetobj = MIME::Charset->new($cset || "",
+					 Mapping => $Params{Mapping});
+	# determine charset and encoding
+	# try defaults only if 7-bit charset detection is not required
 	my $enc;
-
-	next unless length($s);
-
-	# Unicode string should be encoded by given charset.
-	# Unsupported charset will be fallbacked to UTF-8.
-	if (is_utf8($s) or $s =~ $WIDECHAR) {
-	    unless ($csetobj->decoder) {
-		if ($s !~ $UNSAFE) {
-		    $cset = "US-ASCII";
-		} elsif ($Params{Replacement} =~ /^(CROAK|STRICT)$/) {
-		    croak "unsupported charset ``$cset''";
-		} else {
-		    $cset = "UTF-8";
-		}
-	    }
-	    $csetobj = MIME::Charset->new($cset, Mapping => $Params{Mapping});
-	    if ($Params{Replacement} =~ /^(CROAK|STRICT)$/) {
-		$s = $csetobj->undecode($s, FB_CROAK());
-	    } else {
-		$s = $csetobj->undecode($s, 0);
-	    }
-	}
-
-	# Determine charset and encoding.
-	if ($Params{Encoding} eq "A") {
-	    my $obj = $cset? $csetobj: $charsetobj;
-	    ($s, $cset, $enc) =
-		$obj->header_encode($s,
-				    Detect7bit => $Params{Detect7bit},
-				    Replacement => $Params{Replacement});
-	    if ($cset eq "8BIT") {
-		$cset = $Config->{Charset};
-		$csetobj = MIME::Charset->new($cset,
-					      Mapping => $Params{Mapping});
-		$enc = $csetobj->header_encoding;
-	    } else {
-		$csetobj = MIME::Charset->new($cset,
-					      Mapping => $Params{Mapping});
-	    }
-	} elsif (!$cset or $cset ne "US-ASCII") {
-	    $cset ||= $Params{Charset} || $Config->{Charset};
-	    $csetobj = MIME::Charset->new($cset, Mapping => $Params{Mapping});
-	    my $u = $s;
-	    $@ = '';
-	    eval {
-		$u = $csetobj->decode($u, 0);
-	    } if MIME::Charset::USE_ENCODE;
-	    if ($@ or $u =~ $UNSAFE) {
-		$enc = $Params{Encoding};
-	    } else {
-		($cset, $enc) = ("US-ASCII", undef);
-		$csetobj = MIME::Charset->new($cset, Mapping => "STANDARD");
-	    }
-	}
-
-	# Now no charset transformations are needed.
+	my $obj = $csetobj;
+	unless ($obj->as_string) {
+	    if ($Params{Encoding} ne "A" or $Params{Detect7bit} eq "NO" or
+		$s =~ /$UNSAFE/) {
+		$obj = $charsetobj;
+	    }
+	}
+	($s, $cset, $enc) =
+	    $obj->header_encode($s,
+				Detect7bit => $Params{Detect7bit},
+				Replacement => $Params{Replacement},
+				Encoding => $Params{Encoding});
+	# pure ASCII
+	if ($cset eq "US-ASCII" and !$enc and $s =~ /$UNSAFEASCII/) {
+	    # pure ASCII with unsafe sequences should be encoded
+	    $cset = $csetobj->output_charset ||
+		$charsetobj->output_charset ||
+		$ascii->output_charset;
+	    $csetobj = MIME::Charset->new($cset,
+					  Mapping => $Params{Mapping});
+	    $enc = $csetobj->header_encoding || 'Q';
+	} else {
+	    $csetobj = MIME::Charset->new($cset,
+					  Mapping => $Params{Mapping});
+	}
+
+	# Now no charset translations are needed.
 	$csetobj->encoder($csetobj);
 
 	# Concatenate adjacent ``words'' so that multibyte sequences will
@@ -754,8 +787,8 @@
 		($lastenc || "") eq ($enc || "")) {
 		$triplets[-1]->[0] .= $s;
 		next;
-	    } elsif (!$lastenc and $enc and $last !~ /[\t ]$/) {
-		if ($last =~ /^(.*)([\t ])([$PRINTABLE]+)$/s) {
+	    } elsif (!$lastenc and $enc and $last !~ /[\r\n\t ]$/) {
+		if ($last =~ /^(.*)([\r\n\t ])([$PRINTABLE]+)$/s) {
 		    $triplets[-1]->[0] = $1.$2;
 		    $s = $3.$s;
 		} elsif ($lastcsetobj->as_string eq "US-ASCII") {
@@ -764,8 +797,8 @@
 		    $triplets[-1]->[2] = $csetobj;
 		    next;
 		}
-	    } elsif ($lastenc and !$enc and $s !~ /^[\t ]/) {
-		if ($s =~ /^([$PRINTABLE]+)([\t ])(.*)$/s) {
+	    } elsif ($lastenc and !$enc and $s !~ /^[\r\n\t ]/) {
+		if ($s =~ /^([$PRINTABLE]+)([\r\n\t ])(.*)$/s) {
 		    $triplets[-1]->[0] .= $1;
 		    $s = $2.$3;
 		} elsif ($csetobj->as_string eq "US-ASCII") {
@@ -778,8 +811,8 @@
     }
 
     # chop leading FWS
-    while ($triplets[0]->[0] =~ s/^[\r\n\t ]+//) {
-	shift @triplets unless $triplets[0]->[0];
+    while (scalar(@triplets) and $triplets[0]->[0] =~ s/^[\r\n\t ]+//) {
+	shift @triplets unless length($triplets[0]->[0]);
     }
 
     # Split long ``words''.
@@ -788,23 +821,21 @@
     foreach (@triplets) {
 	my ($s, $enc, $csetobj) = @$_;
 
-	if ($enc and $restlen < $csetobj->encoded_header_len("\a", $enc) or
-	    !$enc and $restlen < length($s) - ($s =~ /^[\t ]/? 1: 0)) {
-	    $restlen = $maxrestlen;
-	}
-
 	push @splitted, &_split($s, $enc, $csetobj, $restlen, $maxrestlen);
 	my ($last, $lastenc, $lastcsetobj) = @{$splitted[-1]};
+	my $lastlen;
 	if ($lastenc) {
-	    $restlen -= $lastcsetobj->encoded_header_len($last, $lastenc);
+	    $lastlen = $lastcsetobj->encoded_header_len($last, $lastenc);
 	} else {
-	    $restlen -= length($last); # FIXME: Sometimes estimated longer
-	}
+	    $lastlen = length($last);
+	}
+	$restlen -= $lastlen; # FIXME: Sometimes estimated longer
+	$restlen = $maxrestlen if $restlen <= 1;
     }
 
     # Do encoding.
     my @lines;
-    my $linelen = $firstlinelen;
+    $restlen = $firstlinelen;
     foreach (@splitted) {
 	my ($str, $encoding, $charsetobj) = @$_;
 	next unless length($str);
@@ -813,22 +844,22 @@
 	if (!$encoding) {
 	    $s = $str;
 	} else {
-	    $s = &encode_mimeword($str, $encoding, $charsetobj->as_string);
-	}
-
-	my $spc = (scalar(@lines) and $lines[-1] =~ /[\t ]$/ or
-		   $s =~ /^[\t ]/)? '': ' ';
+	    $s = encode_mimeword($str, $encoding, $charsetobj);
+	}
+
+	my $spc = (scalar(@lines) and $lines[-1] =~ /[\r\n\t ]$/ or
+		   $s =~ /^[\r\n\t ]/)? '': ' ';
 	if (!scalar(@lines)) {
 	    push @lines, $s;
-	} elsif (length($lines[-1].$spc.$s) <= $linelen) {
+	} elsif (length($lines[-1].$spc.$s) <= $restlen) {
 	    $lines[-1] .= $spc.$s;
 	} else {
 	    if ($lines[-1] =~ s/([\r\n\t ]+)$//) {
 		$s = $1.$s;
 	    }
-	    $s =~ s/^[\t ]//; # strip only one WSP replaced by that of FWS
+	    $s =~ s/^[\r\n]*[\t ]//; # strip only one WSP replaced by FWS
 	    push @lines, $s;
-	    $linelen = $maxrestlen;
+	    $restlen = $maxrestlen;
 	}
     }
 
@@ -866,10 +897,17 @@
 	    last;
 	}
 	$ustr = $str;
-	if (MIME::Charset::USE_ENCODE) {
+	if (!(is_utf8($ustr) or $ustr =~ /$WIDECHAR/) and
+	    MIME::Charset::USE_ENCODE) {
 	    $ustr = $charset->decode($ustr);
 	}
 	($first, $str) = &_clip_unsafe($ustr, $encoding, $charset, $restlen);
+	# retry splitting if failed
+	if ($first and !$str and
+	    $maxrestlen < $charset->encoded_header_len($first, $encoding)) {
+	    ($first, $str) = &_clip_unsafe($ustr, $encoding, $charset,
+					   $maxrestlen);
+	}
 	push @splitted, [$first, $encoding, $charset];
 	$restlen = $maxrestlen;
     }
@@ -879,9 +917,7 @@
 # _split_ascii RAW, ROOM_OF_FIRST_LINE, MAXRESTLEN
 #     Private: used by encode_mimewords() to split an US-ASCII string into
 #     (encoded or non-encoded) words.
-#     Returns an array of arrayrefs [SUBSTRING, ENCODING, "US-ASCII"],
-#     where ENCODING is either undef or (if any unsafe sequences are
-#     included) "Q".
+#     Returns an array of arrayrefs [SUBSTRING, undef, "US-ASCII"].
 sub _split_ascii {
     my $s = shift;
     my $restlen = shift;
@@ -891,12 +927,6 @@
     my @splitted;
     my $ascii = MIME::Charset->new("US-ASCII", Mapping => 'STANDARD');
     foreach my $line (split(/(?:[\t ]*[\r\n]+)+/, $s)) {
-	if (length($line) <= $restlen and $line !~ /=\?|$UNSAFE/) {
-	    push @splitted, [$line, undef, $ascii];
-	    $restlen = $maxrestlen;
-	    next;
-	}
-
         my $spc = '';
 	foreach my $word (split(/([\t ]+)/, $line)) {
 	    next unless scalar(@splitted) or $word; # skip first garbage
@@ -905,44 +935,22 @@
 		next;
 	    }
 
-	    my $enc = ($word =~ /=\?|$UNSAFE/)? "Q": undef;
+	    my $cont = $spc.$word;
+	    my $elen = length($cont);
+	    next unless $elen;
 	    if (scalar(@splitted)) {
-		my ($last, $lastenc, $lastcsetobj) = @{$splitted[-1]};
-		my ($elen, $cont, $appe);
-
 		# Concatenate adjacent words so that encoded-word and
 		# unencoded text will adjoin with separating whitespace.
-		if (!$lastenc and !$enc) {
-		    $elen = length($spc.$word);
-		    ($cont, $appe) = ($spc.$word, "");
-		} elsif (!$lastenc and $enc) {
-		    $elen = length($spc) +
-			$ascii->encoded_header_len($word, "Q");
-		    ($cont, $appe) = ($spc, $word);
-		} elsif ($lastenc and !$enc) {
-		    $elen = length($spc.$word);
-		    ($cont, $appe) = ("", $spc.$word);
-		} else {
-		    $elen = $ascii->encoded_header_len($spc.$word, "Q") - 15;
-		    ($cont, $appe) = ($spc.$word, "");
-		}
 		if ($elen <= $restlen) {
-		    $splitted[-1]->[0] .= $cont if $cont;
-		    push @splitted, [$appe, $enc, $ascii] if $appe;
+		    $splitted[-1]->[0] .= $cont;
 		    $restlen -= $elen;
 		} else {
-		    push @splitted, [$cont, $lastenc, $ascii] if $cont;
-		    push @splitted, [$appe, $enc, $ascii] if $appe;
+		    push @splitted, [$cont, undef, $ascii];
 		    $restlen = $maxrestlen - $elen;
-		    $restlen -= 15 if $lastenc and $enc;
 		}
 	    } else {
-		push @splitted, [$spc.$word, $enc, $ascii];
-		if ($enc) {
-		    $restlen -= $ascii->encoded_header_len($spc.$word, "Q");
-		} else {
-		    $restlen -= length($spc.$word);
-		}
+		push @splitted, [$cont, undef, $ascii];
+		$restlen -= $elen;
 	    }
 	    $spc = '';
 	}
@@ -950,7 +958,7 @@
 	    if (scalar(@splitted)) {
 		$splitted[-1]->[0] .= $spc;
 		$restlen -= length($spc);
-	    } else { # NOTREACHED
+	    } else { # only WSPs
 		push @splitted, [$spc, undef, $ascii];
 		$restlen = $maxrestlen - length($spc);
 	    }

Modified: branches/upstream/libmime-encwords-perl/current/EncWords/JA_JP.pod
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/EncWords/JA_JP.pod?rev=18560&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/EncWords/JA_JP.pod (original)
+++ branches/upstream/libmime-encwords-perl/current/EncWords/JA_JP.pod Sun Apr 13 12:06:16 2008
@@ -41,7 +41,7 @@
 =head1 DESCRIPTION
 
 合衆国の諸君。このモジュールでいったい何をやらかそうというのか、
-わからないかもしれないね。欧州、ロシアの諸君なら、わかるだろう。C<(:-)>。
+わからないかもしれないね。欧州、ロシア等の諸君なら、わかるだろう。C<(:-)>。
 
 たとえば、これは有効な MIME ヘッダだ:
 
@@ -61,7 +61,7 @@
 
 B<追補>: 合衆国、欧州の諸君。
 このモジュールでいったいなにをやらかそうというのか、
-わからないかもしれないね。東アジアの諸君なら、わかるだろう。
+わからないかもしれないね。東アジア等の諸君なら、わかるだろう。
 C<(^_^)>.
 
 たとえば、これは有効な MIME ヘッダだ:

Modified: branches/upstream/libmime-encwords-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/META.yml?rev=18560&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/META.yml (original)
+++ branches/upstream/libmime-encwords-perl/current/META.yml Sun Apr 13 12:06:16 2008
@@ -1,13 +1,13 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         MIME-EncWords
-version:      1.009
+version:      1.010
 version_from: EncWords.pm
 installdirs:  site
 requires:
     Encode:                        1.98
     MIME::Base64:                  2.13
-    MIME::Charset:                 1.004
+    MIME::Charset:                 1.006
     Test:                          0
 
 distribution_type: module

Modified: branches/upstream/libmime-encwords-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/Makefile.PL?rev=18560&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/Makefile.PL (original)
+++ branches/upstream/libmime-encwords-perl/current/Makefile.PL Sun Apr 13 12:06:16 2008
@@ -6,11 +6,11 @@
 	'VERSION_FROM'	=> 'EncWords.pm',
 	'PREREQ_PM'	=> ($] >= 5.008001)? {
 	    'Encode'		=> 1.98,
-	    'MIME::Charset'	=> 1.004,
+	    'MIME::Charset'	=> 1.006,
 	    'MIME::Base64'	=> 2.13,
 	    'Test'		=> 0,
 	}: {
-	    'MIME::Charset'	=> 1.004,
+	    'MIME::Charset'	=> 1.006,
 	    'MIME::Base64'	=> 2.13,
 	    'Test'		=> 0,
 	},

Modified: branches/upstream/libmime-encwords-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/README?rev=18560&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/README (original)
+++ branches/upstream/libmime-encwords-perl/current/README Sun Apr 13 12:06:16 2008
@@ -55,7 +55,8 @@
           Subject: If you can read this you understand the example... cool!
 
     Supplement: Fellow Americans, Europeans, you probably won't know what
-    the hell this module is for. East Asians, et al, you probably do. ":-)".
+    the hell this module is for. East Asians, et al, you probably do.
+    "(^_^)".
 
     For example, here's a valid MIME header you might get:
 

Modified: branches/upstream/libmime-encwords-perl/current/t/01decode.t
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/t/01decode.t?rev=18560&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/t/01decode.t (original)
+++ branches/upstream/libmime-encwords-perl/current/t/01decode.t Sun Apr 13 12:06:16 2008
@@ -1,7 +1,7 @@
 use strict;
 use Test;
 
-BEGIN { plan tests => ($] >= 5.008001)? 42: 10 }
+BEGIN { plan tests => ($] >= 5.008001)? 48: 16 }
 
 use MIME::EncWords qw(decode_mimewords);
 $MIME::EncWords::Config = {
@@ -16,9 +16,7 @@
     Minimal => 'YES',
 };
 
-my @testins = MIME::Charset::USE_ENCODE?
-	      qw(decode-singlebyte decode-multibyte):
-	      qw(decode-singlebyte);
+my @testins = qw(decode-singlebyte decode-multibyte decode-ascii);
 
 {
   local($/) = '';
@@ -32,7 +30,8 @@
 	$isgood = (uc($isgood) eq 'GOOD');
 	($expect, $charset, $ucharset) = eval $expect;
 
-	my $dec = decode_mimewords($enc, Charset => $charset);
+	# Convert to raw data...
+	my $dec = decode_mimewords($enc);
 	ok((($isgood && !$@) or (!$isgood && $@)) and
            ($isgood ? ($dec eq $expect) : 1));
 	if (MIME::Charset::USE_ENCODE) {

Modified: branches/upstream/libmime-encwords-perl/current/t/02encode.t
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/t/02encode.t?rev=18560&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/t/02encode.t (original)
+++ branches/upstream/libmime-encwords-perl/current/t/02encode.t Sun Apr 13 12:06:16 2008
@@ -1,7 +1,7 @@
 use strict;
 use Test;
 
-BEGIN { plan tests => ($] >= 5.008001)? 17: 12 }
+BEGIN { plan tests => ($] >= 5.008001)? 26: 12 }
 
 use MIME::EncWords qw(encode_mimewords);
 $MIME::EncWords::Config = {
@@ -17,7 +17,7 @@
 };
 
 my @testins = MIME::Charset::USE_ENCODE?
-	      qw(encode-singlebyte encode-multibyte):
+	      qw(encode-singlebyte encode-multibyte encode-ascii):
 	      qw(encode-singlebyte);
 
 {
@@ -32,8 +32,8 @@
 	my @params = eval $dec;
 
 	my $enc = encode_mimewords(@params);
-	ok((($isgood && !$@) or (!$isgood && $@)) and
-           ($isgood ? ($enc eq $expect) : 1));
+	ok((($isgood && !$@) or (!$isgood && $@)) &&
+           ($isgood ? $enc : $expect), $expect, $enc);
     }
     close WORDS;
   }

Added: branches/upstream/libmime-encwords-perl/current/testin/decode-ascii.txt
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/testin/decode-ascii.txt?rev=18560&op=file
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/testin/decode-ascii.txt (added)
+++ branches/upstream/libmime-encwords-perl/current/testin/decode-ascii.txt Sun Apr 13 12:06:16 2008
@@ -1,0 +1,10 @@
+GOOD
+("Subject: Notification d'+AOk-tat de remise (+AOk-chec)","utf-7","iso-8859-1")
+Subject: Notification =?utf-7?Q?d=27+AOk-tat?= de remise
+ =?utf-7?Q?(+AOk-chec)?=
+
+GOOD
+("The next sentence is in GB.~{<:Ky2;S{#,NpJ)l6HK!#~}Bye.", "hz")
+The next sentence is in
+ =?HZ-GB-2312?B?R0Iufns8Okt5MjtTeyMsTnBKKWw2SEshI359QnllLg==?=
+

Added: branches/upstream/libmime-encwords-perl/current/testin/encode-ascii.txt
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/testin/encode-ascii.txt?rev=18560&op=file
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/testin/encode-ascii.txt (added)
+++ branches/upstream/libmime-encwords-perl/current/testin/encode-ascii.txt Sun Apr 13 12:06:16 2008
@@ -1,0 +1,41 @@
+GOOD
+([["Perl=?: "], ["\x1B\x24BIBE*\x40^Co<g5AE*GQJ*=PNO4o\x1B(B", "ISO-2022-JP"], [" (Pathologically Eclectic Rubbish Lister)"]])
+=?ISO-8859-1?Q?Perl=3D=3F=3A_?= =?ISO-2022-JP?B?GyRCSUJFKkBeQ288ZzVBGyhC?=
+ =?ISO-2022-JP?B?GyRCRSpHUUoqPVBOTzRvGyhC?= (Pathologically
+ Eclectic Rubbish Lister)
+
+GOOD
+([["Perl=?: "], ["\x1B\x24BIBE*\x40^Co<g5AE*GQJ*=PNO4o\x1B(B", "ISO-2022-JP"], [" (Pathologically Eclectic Rubbish Lister)"]], Charset => "EUC-JP")
+=?ISO-2022-JP?B?UGVybD0/OiAbJEJJQkUqQF5DbzxnNUFFKkdRSio9UE5PNG8bKEI=?=
+ (Pathologically Eclectic Rubbish Lister)
+
+GOOD
+("Perl=?: \x1B\x24BIBE*\x40^Co<g5AE*GQJ*=PNO4o\x1B(B (Pathologically Eclectic Rubbish Lister)", Charset => "iso-2022-jp")
+=?ISO-2022-JP?B?UGVybD0/OiAbJEJJQkUqQF5DbzxnNUFFKkdRSio9UE5PNG8bKEI=?=
+ (Pathologically Eclectic Rubbish Lister)
+
+GOOD
+("Peeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerl: \x1B\x24BIBE*\x40^Co<g5AE*GQJ*=PNO4o\x1B(B (Pathologically Eclectic Rubbish Lister)", Charset => "iso-2022-jp")
+=?ISO-2022-JP?B?UGVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVl?=
+ =?ISO-2022-JP?B?ZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZXJsOiA=?=
+ =?ISO-2022-JP?B?GyRCSUJFKkBeQ288ZzVBRSpHUUoqPVBOTzRvGyhC?= (Pathologically
+ Eclectic Rubbish Lister)
+
+GOOD
+("Perl: \x1B\x24BIBE*\x40^Co<g5AE*GQJ*=PNO4o\x1B(B (Pathologicalllllllllly-Ecleclecleclecleclectic-Rubbbbbbbbbbish-Listeeeeeer)", Charset => "iso-2022-jp")
+Perl: =?ISO-2022-JP?B?GyRCSUJFKkBeQ288ZzVBRSpHUUoqPVBOTzRvGyhCIChQYXRob2xv?=
+ =?ISO-2022-JP?B?Z2ljYWxsbGxsbGxsbGx5LUVjbGVjbGVjbGVjbGVjbGVjbGVjdGljLVJ1?=
+ =?ISO-2022-JP?B?YmJiYmJiYmJiYmlzaC1MaXN0ZWVlZWVlcik=?=
+
+GOOD
+("The next sentence is in GB.~{<:Ky2;S{#,NpJ)l6HK!#~}Bye.", MaxLineLen => 42, Charset => "HZ-GB-2312")
+The next sentence is in
+ =?HZ-GB-2312?B?R0Iufns8Okt5MjtTeyMsfn0=?=
+ =?HZ-GB-2312?B?fntOcEopbDZISyEjfn1CeWUu?=
+
+GOOD
+([["The next sentence is in GB. "], ["~{<:Ky2;S{#,NpJ)l6HK!#~}", "hzgb2312"], [" Bye."]],  MaxLineLen => 42, Charset => "")
+The next sentence is in GB.
+ =?HZ-GB-2312?B?fns8Okt5MjtTeyMsTnBKKX59?=
+ =?HZ-GB-2312?B?fntsNkhLISN+fQ==?= Bye.
+

Modified: branches/upstream/libmime-encwords-perl/current/testin/encode-multibyte.txt
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/testin/encode-multibyte.txt?rev=18560&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/testin/encode-multibyte.txt (original)
+++ branches/upstream/libmime-encwords-perl/current/testin/encode-multibyte.txt Sun Apr 13 12:06:16 2008
@@ -23,3 +23,14 @@
 Perl: =?ISO-2022-JP?B?GyRCSUJFKkBeQ288ZzVBRSpHUUoqPVBOTzRvGyhC?=
  (Pathologically Eclectic Rubbish Lister)
 
+GOOD
+("Perl - Pathologically Eclectic Rubbish Lister \x1b\x24BIBE*\x40^Co<g5AE*GQJ*=PNO4o\x24r<B8=\x249\x24k8\x408l\x1b(B", Charset => "iso-2022-jp", Field => "")
+Perl - Pathologically Eclectic Rubbish Lister =?ISO-2022-JP?B?GyRCSUIbKEI=?=
+ =?ISO-2022-JP?B?GyRCRSpAXkNvPGc1QUUqR1FKKj1QTk80byRyPEI4PSQ5JGs4QDhsGyhC?=
+
+GOOD
+("Perl -- Pathologically Eclectic Rubbish Lister \x1b\x24BIBE*\x40^Co<g5AE*GQJ*=PNO4o\x24r<B8=\x249\x24k8\x408l\x1b(B", Charset => "iso-2022-jp", Field => "")
+Perl -- Pathologically Eclectic Rubbish Lister
+ =?ISO-2022-JP?B?GyRCSUJFKkBeQ288ZzVBRSpHUUoqPVBOTzRvJHI8Qjg9JDkkazhAGyhC?=
+ =?ISO-2022-JP?B?GyRCOGwbKEI=?=
+

Modified: branches/upstream/libmime-encwords-perl/current/testin/encode-singlebyte.txt
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/testin/encode-singlebyte.txt?rev=18560&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/testin/encode-singlebyte.txt (original)
+++ branches/upstream/libmime-encwords-perl/current/testin/encode-singlebyte.txt Sun Apr 13 12:06:16 2008
@@ -12,7 +12,7 @@
 
 GOOD
 ([["Andr\xE9 "],["(<- one space) Pirard"],[" "],["<PIRARD\@vm1.ulg.ac.be>"]], Charset => "iso-8859-1")
-=?ISO-8859-1?Q?Andr=E9_(<-?= one space) Pirard <PIRARD at vm1.ulg.ac.be>
+=?ISO-8859-1?Q?Andr=E9_=28=3C-?= one space) Pirard <PIRARD at vm1.ulg.ac.be>
 
 GOOD
 ([["Andr\xE9"],[" (<- one space) Pirard"],[" "],["<PIRARD\@vm1.ulg.ac.be>"]], Charset => "iso-8859-1")
@@ -20,7 +20,7 @@
 
 GOOD
 ([["Andr\xE9  "],["(<- two spaces) Pirard"],[" "],["<PIRARD\@vm1.ulg.ac.be>"]], Charset => "iso-8859-1")
-=?ISO-8859-1?Q?Andr=E9__(<-?= two spaces) Pirard <PIRARD at vm1.ulg.ac.be>
+=?ISO-8859-1?Q?Andr=E9__=28=3C-?= two spaces) Pirard <PIRARD at vm1.ulg.ac.be>
 
 GOOD
 ([["Andr\xE9 "],[" (<- two spaces) Pirard"],[" "],["<PIRARD\@vm1.ulg.ac.be>"]], Charset => "ISO-8859-1")
@@ -41,8 +41,8 @@
 
 GOOD
 ("Th\xE8me tr\xE8s important\xA0: La r\xE9alisation du Syst\xE8me de R\xE9f\xE9rence C\xE9leste", Charset => "iso-8859-1")
-=?ISO-8859-1?Q?Th=E8me_tr=E8s_important=A0:?= La =?ISO-8859-1?Q?r=E9alisat?=
- =?ISO-8859-1?Q?ion?= du =?ISO-8859-1?Q?Syst=E8me?= de
+=?ISO-8859-1?Q?Th=E8me_tr=E8s_important=A0=3A?= La =?ISO-8859-1?Q?r=E9alis?=
+ =?ISO-8859-1?Q?ation?= du =?ISO-8859-1?Q?Syst=E8me?= de
  =?ISO-8859-1?Q?R=E9f=E9rence_C=E9leste?=
 
 GOOD




More information about the Pkg-perl-cvs-commits mailing list