r18380 - in /trunk/libmime-charset-perl: Changes Charset.pm Charset/JA_JP.pod META.yml README debian/changelog t/02enclen.t t/02ooenclen.t
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Mon Apr 7 16:47:48 UTC 2008
Author: gregoa-guest
Date: Mon Apr 7 16:47:47 2008
New Revision: 18380
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=18380
Log:
New upstream release.
Modified:
trunk/libmime-charset-perl/Changes
trunk/libmime-charset-perl/Charset.pm
trunk/libmime-charset-perl/Charset/JA_JP.pod
trunk/libmime-charset-perl/META.yml
trunk/libmime-charset-perl/README
trunk/libmime-charset-perl/debian/changelog
trunk/libmime-charset-perl/t/02enclen.t
trunk/libmime-charset-perl/t/02ooenclen.t
Modified: trunk/libmime-charset-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmime-charset-perl/Changes?rev=18380&op=diff
==============================================================================
--- trunk/libmime-charset-perl/Changes (original)
+++ trunk/libmime-charset-perl/Changes Mon Apr 7 16:47:47 2008
@@ -1,3 +1,11 @@
+2008-04-07 Hatuka*nezumi - IKEDA Soji <hatuka at nezumi.nu>
+ * Release 1.005.
+ * _enclen_Q(): Restrict characters in encoded-word
+ according to RFC 2047 section 5 (3).
+ * New method dup().
+ * body_encode() / header_encode(): Fix determination of
+ US-ASCII: Works on pre-Encode environments.
+
2008-03-30 Hatuka*nezumi - IKEDA Soji <hatuka at nezumi.nu>
* Release 1.004.
* Added ESTI GSM 03.38 which won't be used for MIME
Modified: trunk/libmime-charset-perl/Charset.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmime-charset-perl/Charset.pm?rev=18380&op=diff
==============================================================================
--- trunk/libmime-charset-perl/Charset.pm (original)
+++ trunk/libmime-charset-perl/Charset.pm Mon Apr 7 16:47:47 2008
@@ -110,7 +110,7 @@
use constant USE_ENCODE => ($] >= 5.008001)? 'Encode': '';
my @ENCODE_SUBS = qw(FB_CROAK FB_PERLQQ FB_HTMLCREF FB_XMLCREF
- from_to is_utf8 resolve_alias);
+ is_utf8 resolve_alias);
if (USE_ENCODE) {
eval "use ".USE_ENCODE." \@ENCODE_SUBS;";
} else {
@@ -121,7 +121,7 @@
}
}
-$VERSION = '1.004';
+$VERSION = '1.005';
######## Private Attributes ########
@@ -275,8 +275,12 @@
######## Private Constants ########
+my $NON7BITRE = qr{
+ [^\x01-\x7e]
+}x;
+
my $NONASCIIRE = qr{
- [^\x01-\x7e]
+ [^\x09\x0a\x0d\x20\x21-\x7e]
}x;
my $ISO2022RE = qr{
@@ -385,7 +389,7 @@
sub body_encoding($) {
my $self = shift;
return undef unless $self;
- $self = MIME::Charset->new($self) unless ref $self;
+ $self = __PACKAGE__->new($self) unless ref $self;
$self->{BodyEncoding};
}
@@ -400,7 +404,7 @@
sub canonical_charset($) {
my $self = shift;
return undef unless $self;
- $self = MIME::Charset->new($self) unless ref $self;
+ $self = __PACKAGE__->new($self) unless ref $self;
$self->{InputCharset};
}
@@ -418,6 +422,19 @@
sub decoder($) {
my $self = shift;
$self->{Decoder};
+}
+
+=item $charset->dup
+
+Get a copy of charset object.
+
+=cut
+
+sub dup($) {
+ my $self = shift;
+ my $obj = __PACKAGE__->new(undef);
+ %{$obj} = %{$self};
+ $obj;
}
=item $charset->encoder([CHARSET])
@@ -436,7 +453,7 @@
my $self = shift;
my $charset = shift;
if ($charset) {
- $charset = MIME::Charset->new($charset) unless ref $charset;
+ $charset = __PACKAGE__->new($charset) unless ref $charset;
$self->{OutputCharset} = $charset->{InputCharset};
$self->{Encoder} = $charset->{Decoder};
#XXX$self->{BodyEncoding} = $charset->{BodyEncoding};
@@ -460,7 +477,7 @@
sub header_encoding($) {
my $self = shift;
return undef unless $self;
- $self = MIME::Charset->new($self) unless ref $self;
+ $self = __PACKAGE__->new($self) unless ref $self;
$self->{HeaderEncoding};
}
@@ -480,7 +497,7 @@
sub output_charset($) {
my $self = shift;
return undef unless $self;
- $self = MIME::Charset->new($self) unless ref $self;
+ $self = __PACKAGE__->new($self) unless ref $self;
$self->{OutputCharset};
}
@@ -530,7 +547,7 @@
$text = shift;
} else {
$text = $self;
- $self = MIME::Charset->new(shift);
+ $self = __PACKAGE__->new(shift);
}
my ($encoded, $charset) = &_text_encode($self, $text, @_);
return ($encoded, undef, 'BASE64')
@@ -539,20 +556,15 @@
# Determine transfer-encoding.
my $enc;
- my $dummy = $encoded;
- eval {
- from_to($dummy, $cset, "US-ASCII", FB_CROAK());
- };
- if (!$@ and $dummy eq $encoded) {
+ if ($encoded !~ /$NONASCIIRE/) {
$cset = "US-ASCII";
$enc = undef;
} else {
- $@ = '';
$enc = $charset->{BodyEncoding};
}
if (!$enc and $encoded !~ /\x00/) { # Eliminate hostile NUL character.
- if ($encoded =~ $NONASCIIRE) { # String contains 8bit char(s).
+ if ($encoded =~ $NON7BITRE) { # String contains 8bit char(s).
$enc = '8BIT';
} elsif ($cset =~ $ISO2022RE) { # ISO-2022-* outputs are 7BIT.
$enc = '7BIT';
@@ -633,7 +645,7 @@
$s = $self;
$encoding = uc(shift);
$self = shift;
- $self = MIME::Charset->new($self) unless ref $self;
+ $self = __PACKAGE__->new($self) unless ref $self;
}
#FIXME:$encoding === undef
@@ -657,8 +669,7 @@
sub _enclen_Q($) {
my $s = shift;
- my @o;
- @o = ($s =~ /(\?|=|_|[^ \x21-\x7e])/gos);
+ my @o = ($s =~ m{([^- !*+/0-9A-Za-z])}gos);
length($s) + scalar(@o) * 2;
}
@@ -709,7 +720,7 @@
$text = shift;
} else {
$text = $self;
- $self = MIME::Charset->new(shift);
+ $self = __PACKAGE__->new(shift);
}
my ($encoded, $charset) = &_text_encode($self, $text, @_);
return ($encoded, '8BIT', undef)
@@ -718,19 +729,14 @@
# Determine encoding scheme.
my $enc;
- my $dummy = $encoded;
- eval {
- from_to($dummy, $cset, "US-ASCII", FB_CROAK());
- };
- if (!$@ and $dummy eq $encoded) {
+ if ($encoded !~ /$NONASCIIRE/) {
$cset = "US-ASCII";
$enc = undef;
} else {
- $@ = '';
$enc = $charset->{HeaderEncoding};
}
- if (!$enc and $encoded !~ $NONASCIIRE) {
+ if (!$enc and $encoded !~ $NON7BITRE) {
unless ($cset =~ $ISO2022RE) { # ISO-2022-* outputs are 7BIT.
$cset = 'US-ASCII';
}
@@ -754,12 +760,12 @@
my $detect7bit = uc($params{'Detect7bit'} || $Config->{Detect7bit});
unless ($charset and $charset->{InputCharset}) {
- if ($s =~ $NONASCIIRE) {
+ if ($s =~ $NON7BITRE) {
return ($s, undef);
} elsif ($detect7bit ne "NO") {
- $charset = MIME::Charset->new(&_detect_7bit_charset($s));
+ $charset = __PACKAGE__->new(&_detect_7bit_charset($s));
} else {
- $charset = MIME::Charset->new($DEFAULT_CHARSET);
+ $charset = __PACKAGE__->new($DEFAULT_CHARSET);
}
}
@@ -793,7 +799,7 @@
};
if ($@) {
if ($replacement eq "FALLBACK" and $FALLBACK_CHARSET) {
- my $cset = MIME::Charset->new($FALLBACK_CHARSET);
+ my $cset = __PACKAGE__->new($FALLBACK_CHARSET);
# croak unknown charset
croak "unknown charset ``$FALLBACK_CHARSET''"
unless $charset->{Decoder};
@@ -828,7 +834,7 @@
foreach (@ESCAPE_SEQS) {
my ($seq, $cset) = @$_;
if (index($s, $seq) >= 0) {
- my $decoder = MIME::Charset->new($cset);
+ my $decoder = __PACKAGE__->new($cset);
next unless $decoder and $decoder->{Decoder};
eval {
my $dummy = $s;
@@ -994,7 +1000,7 @@
$CHARSETS{$charset} = \@spec;
return @spec;
} else {
- $charset = MIME::Charset->new($charset) unless ref $charset;
+ $charset = __PACKAGE__->new($charset) unless ref $charset;
return map { $charset->{$_} } qw(HeaderEncoding BodyEncoding
OutputCharset);
}
Modified: trunk/libmime-charset-perl/Charset/JA_JP.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmime-charset-perl/Charset/JA_JP.pod?rev=18380&op=diff
==============================================================================
--- trunk/libmime-charset-perl/Charset/JA_JP.pod (original)
+++ trunk/libmime-charset-perl/Charset/JA_JP.pod Mon Apr 7 16:47:47 2008
@@ -140,6 +140,12 @@
ãã£ã©ã¯ã¿ã»ããããã³ã¼ãããã®ã«ä½¿ã
L<"Encode::Encoding"> ãªãã¸ã§ã¯ããè¿ãã
+
+=cut
+
+=item $charset->dup
+
+ãã£ã©ã¯ã¿ã»ãããªãã¸ã§ã¯ããè¤åããã
=cut
Modified: trunk/libmime-charset-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmime-charset-perl/META.yml?rev=18380&op=diff
==============================================================================
--- trunk/libmime-charset-perl/META.yml (original)
+++ trunk/libmime-charset-perl/META.yml Mon Apr 7 16:47:47 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-Charset
-version: 1.004
+version: 1.005
version_from: Charset.pm
installdirs: site
requires:
Modified: trunk/libmime-charset-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmime-charset-perl/README?rev=18380&op=diff
==============================================================================
--- trunk/libmime-charset-perl/README (original)
+++ trunk/libmime-charset-perl/README Mon Apr 7 16:47:47 2008
@@ -108,6 +108,9 @@
$charset->decoder
Get "Encode::Encoding" object to decode strings by charset.
+
+ $charset->dup
+ Get a copy of charset object.
$charset->encoder([CHARSET])
Get "Encode::Encoding" object to encode Unicode string using
Modified: trunk/libmime-charset-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmime-charset-perl/debian/changelog?rev=18380&op=diff
==============================================================================
--- trunk/libmime-charset-perl/debian/changelog (original)
+++ trunk/libmime-charset-perl/debian/changelog Mon Apr 7 16:47:47 2008
@@ -1,3 +1,9 @@
+libmime-charset-perl (1.005-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at> Mon, 07 Apr 2008 18:46:44 +0200
+
libmime-charset-perl (1.004-1) unstable; urgency=low
* New upstream release.
Modified: trunk/libmime-charset-perl/t/02enclen.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmime-charset-perl/t/02enclen.t?rev=18380&op=diff
==============================================================================
--- trunk/libmime-charset-perl/t/02enclen.t (original)
+++ trunk/libmime-charset-perl/t/02enclen.t Mon Apr 7 16:47:47 2008
@@ -5,7 +5,7 @@
use MIME::Charset qw(:trans);
-my $s = "Perl\xe8\xa8\x80\xe8\xaa\x9e";
-ok(encoded_header_len($s,"b","utf-8") == 28);
-ok(encoded_header_len($s,"q","utf-8") == 34);
-ok(encoded_header_len($s,"s","utf-8") == 28);
+my $s = "Perl: \xe8\xa8\x80\xe8\xaa\x9e";
+ok(encoded_header_len($s,"b","utf-8"), 28, encoded_header_len($s,"b","utf-8"));
+ok(encoded_header_len($s,"q","utf-8"), 38, encoded_header_len($s,"q","utf-8"));
+ok(encoded_header_len($s,"s","utf-8"), 28, encoded_header_len($s,"s","utf-8"));
Modified: trunk/libmime-charset-perl/t/02ooenclen.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmime-charset-perl/t/02ooenclen.t?rev=18380&op=diff
==============================================================================
--- trunk/libmime-charset-perl/t/02ooenclen.t (original)
+++ trunk/libmime-charset-perl/t/02ooenclen.t Mon Apr 7 16:47:47 2008
@@ -5,9 +5,9 @@
use MIME::Charset qw(:trans);
-my $s = "Perl\xe8\xa8\x80\xe8\xaa\x9e";
+my $s = "Perl: \xe8\xa8\x80\xe8\xaa\x9e";
my $obj = MIME::Charset->new("utf-8");
-ok($obj->encoded_header_len($s) == 28);
-ok($obj->encoded_header_len($s,"b") == 28);
-ok($obj->encoded_header_len($s,"q") == 34);
-ok($obj->encoded_header_len($s,"s") == 28);
+ok($obj->encoded_header_len($s), 28, $obj->encoded_header_len($s));
+ok($obj->encoded_header_len($s,"b"), 28, $obj->encoded_header_len($s,"b"));
+ok($obj->encoded_header_len($s,"q"), 38, $obj->encoded_header_len($s,"q"));
+ok($obj->encoded_header_len($s,"s"), 28, $obj->encoded_header_len($s,"s"));
More information about the Pkg-perl-cvs-commits
mailing list