r16859 - in /branches/upstream/libmime-encwords-perl/current: Changes EncWords.pm META.yml README
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Sat Mar 8 12:12:26 UTC 2008
Author: gregoa-guest
Date: Sat Mar 8 12:10:44 2008
New Revision: 16859
URL: http://svn.debian.org/wsvn/?sc=1&rev=16859
Log:
[svn-upgrade] Integrating new upstream version, libmime-encwords-perl (1.000)
Modified:
branches/upstream/libmime-encwords-perl/current/Changes
branches/upstream/libmime-encwords-perl/current/EncWords.pm
branches/upstream/libmime-encwords-perl/current/META.yml
branches/upstream/libmime-encwords-perl/current/README
Modified: branches/upstream/libmime-encwords-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/Changes?rev=16859&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/Changes (original)
+++ branches/upstream/libmime-encwords-perl/current/Changes Sat Mar 8 12:10:44 2008
@@ -1,3 +1,9 @@
+2008-03-08 Hatuka*nezumi - IKEDA Soji <hatuka at nezumi.nu>
+
+ * Release 1.000.
+ * decode_mimewords(): New option 'Detect7bit', enabled by default.
+ * encode_mimewords(): New option 'Replacement.
+
2006-11-16 Hatuka*nezumi - IKEDA Soji <hatuka at nezumi.nu>
* Release 0.040.
Modified: branches/upstream/libmime-encwords-perl/current/EncWords.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/EncWords.pm?rev=16859&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/EncWords.pm (original)
+++ branches/upstream/libmime-encwords-perl/current/EncWords.pm Sat Mar 8 12:10:44 2008
@@ -4,13 +4,14 @@
=head1 NAME
-MIME::EncWords - deal with RFC-1522 encoded words (improved)
+MIME::EncWords - deal with RFC 2047 encoded words (improved)
=head1 SYNOPSIS
I<L<MIME::EncWords> is aimed to be another implimentation
of L<MIME::Words> so that it will achive more exact conformance with
-MIME specifications. Additionally, it contains some improvements.
+RFC 2047 (former RFC 1522) specifications. Additionally, it contains
+some improvements.
Following synopsis and descriptions are inherited from its inspirer,
with description of improvements and clarifications added.>
@@ -118,7 +119,7 @@
#------------------------------
### The package version, both in 1.23 style *and* usable by MakeMaker:
-$VERSION = '0.040';
+$VERSION = '1.000';
### Nonprintables (controls + x7F + 8bit):
#my $NONPRINT = "\\x00-\\x1F\\x7F-\\xFF";
@@ -225,6 +226,17 @@
This feature is still information-lossy, I<except> when C<"_UNICODE_"> is
specified.
+=item Detect7bit
+
+B<Improvement by this modlue>:
+Try to detect 7-bit charset on unencoded portions.
+Default is C<"YES">.
+When Unicode/multibyte support is disabled,
+this option will not have any effects
+(see L<MIME::Charset/USE_ENCODE>).
+B<Note>:
+This feature was introduced at release 1.000.
+
=item Field
Name of the mail field this string came from. I<Currently ignored.>
@@ -248,6 +260,7 @@
my $encstr = shift;
my %params = @_;
my $cset = $params{"Charset"};
+ my $detect7bit = uc($params{'Detect7bit'} || "YES");
my @tokens;
$@ = ''; ### error-return
@@ -321,6 +334,19 @@
}
push @tokens, [$spc] if $spc;
+ # Detect 7-bit charset
+ if ($detect7bit ne "NO") {
+ foreach my $t (@tokens) {
+ unless ($t->[1]) {
+ my $charset = &MIME::Charset::_detect_7bit_charset($t->[0]);
+ if ($charset and $charset ne &MIME::Charset::default()) {
+ $t->[0] =~ s/[\r\n\t ]+/ /g;
+ $t->[1] = $charset;
+ }
+ }
+ }
+ }
+
return (wantarray ? @tokens : join('',map {
&_convert($_->[0], $_->[1], $cset)
} @tokens));
@@ -404,13 +430,13 @@
if ($encoding eq 'Q') {
$encstr = &_encode_Q($word);
} elsif ($encoding eq "S") {
- if (encoded_header_len($word, "B", $charset) <
- encoded_header_len($word, "Q", $charset)) {
+ my ($B, $Q) = (&_encode_B($word), &_encode_Q($word));
+ if (length($B) < length($Q)) {
$encoding = "B";
- $encstr = &_encode_B($word);
+ $encstr = $B;
} else {
$encoding = "Q";
- $encstr = &_encode_Q($word);
+ $encstr = $Q;
}
} else { # "B"
$encoding = "B";
@@ -491,6 +517,13 @@
compatibility with MIME::Words.
On earlier releases, this option was fixed to be C<"NO">.
+=item Replacement
+
+B<Improvement by this module>:
+See L<MIME::Charset/ERROR HANDLING>.
+B<Note>:
+This feature was introduced at release 1.000.
+
=back
B<Notes on improvement by this module>:
@@ -511,6 +544,7 @@
my $encoding = uc($params{'Encoding'});
my $header_name = $params{'Field'};
my $minimal = uc($params{'Minimal'} || "YES");
+ my $replacement = uc($params{'Replacement'} || 'DEFAULT');
my $firstlinelen = $MAXLINELEN;
if ($header_name) {
$firstlinelen -= length($header_name.': ');
@@ -539,18 +573,25 @@
unless (resolve_alias($cset)) {
if ($s !~ $UNSAFE) {
$cset = "US-ASCII";
+ } elsif ($replacement =~ '^(CROAK|STRICT)$') {
+ croak "MIME::EncWords: unsupported charset: $cset\n";
} else {
$cset = "UTF-8";
}
}
- $s = encode($cset, $s);
+ if ($replacement =~ /^(CROAK|STRICT)$/) {
+ $s = encode($cset, $s, FB_CROAK());
+ } else {
+ $s = encode($cset, $s);
+ }
}
# Determine charset and encoding.
if ($encoding eq "A") {
($s, $cset, $enc) =
header_encode($s, $cset || $charset,
- Detect7bit => $detect7bit);
+ Detect7bit => $detect7bit,
+ Replacement => $replacement);
} else {
$cset ||= ($charset || ($s !~ $UNSAFE)? "US-ASCII": "ISO-8859-1");
$enc = $encoding ||
Modified: branches/upstream/libmime-encwords-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/META.yml?rev=16859&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/META.yml (original)
+++ branches/upstream/libmime-encwords-perl/current/META.yml Sat Mar 8 12:10:44 2008
@@ -1,7 +1,7 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: MIME-EncWords
-version: 0.040
+version: 1.000
version_from: EncWords.pm
installdirs: site
requires:
Modified: branches/upstream/libmime-encwords-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libmime-encwords-perl/current/README?rev=16859&op=diff
==============================================================================
--- branches/upstream/libmime-encwords-perl/current/README (original)
+++ branches/upstream/libmime-encwords-perl/current/README Sat Mar 8 12:10:44 2008
@@ -1,12 +1,12 @@
NAME
- MIME::EncWords - deal with RFC-1522 encoded words (improved)
+ MIME::EncWords - deal with RFC 2047 encoded words (improved)
SYNOPSIS
*MIME::EncWords is aimed to be another implimentation of MIME::Words so
- that it will achive more exact conformance with MIME specifications.
- Additionally, it contains some improvements. Following synopsis and
- descriptions are inherited from its inspirer, with description of
- improvements and clarifications added.*
+ that it will achive more exact conformance with RFC 2047 (former RFC
+ 1522) specifications. Additionally, it contains some improvements.
+ Following synopsis and descriptions are inherited from its inspirer,
+ with description of improvements and clarifications added.*
Before reading further, you should see MIME::Tools to make sure that you
understand where this module fits into the grand scheme of things. Go
@@ -110,6 +110,13 @@
Note: This feature is still information-lossy, *except* when
"_UNICODE_" is specified.
+ Detect7bit
+ Improvement by this modlue: Try to detect 7-bit charset on
+ unencoded portions. Default is "YES". When Unicode/multibyte
+ support is disabled, this option will not have any effects (see
+ "USE_ENCODE" in MIME::Charset). Note: This feature was
+ introduced at release 1.000.
+
Field
Name of the mail field this string came from. *Currently
ignored.*
@@ -181,6 +188,23 @@
by this module: Length of mail field name will be considered in
the first line of encoded header.
+ Minimal
+ Improvement by this module: Takes care of natural word
+ separators (i.e. whitespaces) in the text to be encoded. If "NO"
+ is specified, this module will encode whole text (if encoding
+ needed) not regarding whitespaces; encoded-words exceeding line
+ length will be splitted based only on their lengths. Default is
+ "YES".
+
+ Note: As of release 0.040, default has been changed to "YES" to
+ ensure compatibility with MIME::Words. On earlier releases, this
+ option was fixed to be "NO".
+
+ Replacement
+ Improvement by this module: See "ERROR HANDLING" in
+ MIME::Charset. Note: This feature was introduced at release
+ 1.000.
+
Notes on improvement by this module: When RAW is an arrayref,
adjacent encoded-words are concatenated. Then they are splitted
taking care of character boundaries of multibyte sequences, when
@@ -188,12 +212,6 @@
should include surrounding whitespace(s), or they will be merged
into adjoining encoded word(s).
- Imcompatibility with MIME::Words: MIME::Words takes care of natural
- word separators (i.e. whitespaces) in the text to be encoded. This
- module will encode whole text (if encoding needed) not mentioning
- whitespaces; encoded-words exceeding line length will be splitted
- based only on their lengths.
-
VERSION
Consult $VERSION variable.
More information about the Pkg-perl-cvs-commits
mailing list