diff options
| author | fukachan <fukachan> | 2003-09-17 04:19:07 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-09-17 04:19:07 +0000 |
| commit | 3df4116618fd1f5f5bb00181e21503c7972787e2 (patch) | |
| tree | d35b04697598a1555a2d1de119dd999a664167e4 /cpan/lib | |
| parent | 3403ab4f986f211ac0342778080ef21bae409e43 (diff) | |
| download | fml8-Jcode-0-83.tar.gz fml8-Jcode-0-83.tar.bz2 fml8-Jcode-0-83.zip | |
Jcode-0.83Jcode-0-83
Diffstat (limited to 'cpan/lib')
| -rw-r--r-- | cpan/lib/Jcode.pm | 38 | ||||
| -rw-r--r-- | cpan/lib/Jcode/Constants.pm | 4 | ||||
| -rw-r--r-- | cpan/lib/Jcode/Tr.pm | 8 | ||||
| -rw-r--r-- | cpan/lib/Jcode/Unicode.pm | 4 | ||||
| -rw-r--r-- | cpan/lib/Jcode/Unicode/Constants.pm | 4 |
5 files changed, 40 insertions, 18 deletions
diff --git a/cpan/lib/Jcode.pm b/cpan/lib/Jcode.pm index 0b3683e2..e752b181 100644 --- a/cpan/lib/Jcode.pm +++ b/cpan/lib/Jcode.pm @@ -1,5 +1,5 @@ # -# $Id: Jcode.pm,v 0.79 2002/01/16 02:16:39 dankogai Exp dankogai $ +# $Id: Jcode.pm,v 0.83 2003/03/16 16:15:34 dankogai Exp dankogai $ # =head1 NAME @@ -39,8 +39,8 @@ use Carp; use strict; use vars qw($RCSID $VERSION $DEBUG); -$RCSID = q$Id: Jcode.pm,v 0.79 2002/01/16 02:16:39 dankogai Exp dankogai $; -$VERSION = do { my @r = (q$Revision: 0.79 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +$RCSID = q$Id: Jcode.pm,v 0.83 2003/03/16 16:15:34 dankogai Exp dankogai $; +$VERSION = do { my @r = (q$Revision: 0.83 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; $DEBUG = 0; use Exporter; @@ -221,11 +221,29 @@ sub jfold{ $lines[$i] .= $1; $len += length($1); } - $lines[$i] or pop @lines; + defined($lines[$i]) or pop @lines; $$r_str = join($nl, @lines); return wantarray ? @lines : $self; } +=pod + +=over 4 + +=item $length = $jcode-E<gt>jlength(); + +returns character length properly, rather than byte length. + +=back + +=cut + +sub jlength { + my $self = shift; + my $r_str = $self->[0]; + return scalar (my @char = $$r_str =~ m/($RE{EUC_0212}|$RE{EUC_KANA}|$RE{EUC_C}|[\x00-\xff])/sgo); +} + =head2 Methods that use MIME::Base64 To use methods below, you need MIME::Base64. To install, simply @@ -282,9 +300,13 @@ sub _add_encoded_word { $line = ' '; } while (1) { + my $iso_2022_jp = jcode($target, 'euc')->iso_2022_jp; + if (my $count = ($iso_2022_jp =~ tr/\x80-\xff//d)){ + $DEBUG and warn $count; + $target = jcode($iso_2022_jp, 'iso_2022_jp')->euc; + } my $encoded = '=?ISO-2022-JP?B?' . - MIME::Base64::encode_base64( - jcode($target, 'euc')->iso_2022_jp, '') + MIME::Base64::encode_base64($iso_2022_jp, '') . '?='; if (length($encoded) + length($line) > $bpl) { $target =~ @@ -375,7 +397,7 @@ You can retrieve the number of matches via $j->nmatch; =item $j-E<gt>z2h; -Converts X208 kana (Zenkaku) to X201 kana (Hankazu). +Converts X208 kana (Zenkaku) to X201 kana (Hankaku). You can retrieve the number of matches via $j->nmatch; @@ -600,7 +622,7 @@ sub convert{ my $nmatch; ($icode, $nmatch) = getcode($r_str) unless $icode; - return $$r_str if $icode eq $ocode; # do nothin' + return $$r_str if $icode eq $ocode and !defined $opt; # do nothin' no strict qw(refs); my $method; diff --git a/cpan/lib/Jcode/Constants.pm b/cpan/lib/Jcode/Constants.pm index 57a4b88e..923890d3 100644 --- a/cpan/lib/Jcode/Constants.pm +++ b/cpan/lib/Jcode/Constants.pm @@ -1,5 +1,5 @@ # -# $Id: Constants.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp dankogai $ +# $Id: Constants.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp $ # package Jcode::Constants; @@ -7,7 +7,7 @@ package Jcode::Constants; use strict; use vars qw($RCSID $VERSION); -$RCSID = q$Id: Constants.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp dankogai $; +$RCSID = q$Id: Constants.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp $; $VERSION = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use Carp; diff --git a/cpan/lib/Jcode/Tr.pm b/cpan/lib/Jcode/Tr.pm index 28aac783..9f226267 100644 --- a/cpan/lib/Jcode/Tr.pm +++ b/cpan/lib/Jcode/Tr.pm @@ -1,5 +1,5 @@ # -# $Id: Tr.pm,v 0.77 2002/01/14 11:06:55 dankogai Exp $ +# $Id: Tr.pm,v 0.78 2002/05/03 00:20:16 dankogai Exp $ # package Jcode::Tr; @@ -7,8 +7,8 @@ package Jcode::Tr; use strict; use vars qw($VERSION $RCSID); -$RCSID = q$Id: Tr.pm,v 0.77 2002/01/14 11:06:55 dankogai Exp $; -$VERSION = do { my @r = (q$Revision: 0.77 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +$RCSID = q$Id: Tr.pm,v 0.78 2002/05/03 00:20:16 dankogai Exp $; +$VERSION = do { my @r = (q$Revision: 0.78 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use Carp; @@ -35,7 +35,7 @@ sub tr { sub _maketable{ my( $from, $to, $opt ) = @_; - + $opt ||= ''; $from =~ s/($RE{EUC_0212}-$RE{EUC_0212})/&_expnd3($1)/geo; $from =~ s/($RE{EUC_KANA}-$RE{EUC_KANA})/&_expnd2($1)/geo; $from =~ s/($RE{EUC_C }-$RE{EUC_C })/&_expnd2($1)/geo; diff --git a/cpan/lib/Jcode/Unicode.pm b/cpan/lib/Jcode/Unicode.pm index 5fd9f408..34d15ea2 100644 --- a/cpan/lib/Jcode/Unicode.pm +++ b/cpan/lib/Jcode/Unicode.pm @@ -1,5 +1,5 @@ # -# $Id: Unicode.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp dankogai $ +# $Id: Unicode.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp $ # package Jcode::Unicode; @@ -7,7 +7,7 @@ package Jcode::Unicode; use strict; use vars qw($RCSID $VERSION @ISA @EXPORT $PEDANTIC); -$RCSID = q$Id: Unicode.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp dankogai $; +$RCSID = q$Id: Unicode.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp $; $VERSION = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use Carp; diff --git a/cpan/lib/Jcode/Unicode/Constants.pm b/cpan/lib/Jcode/Unicode/Constants.pm index f3769683..8444611b 100644 --- a/cpan/lib/Jcode/Unicode/Constants.pm +++ b/cpan/lib/Jcode/Unicode/Constants.pm @@ -1,5 +1,5 @@ # -# $Id: Constants.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp dankogai $ +# $Id: Constants.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp $ # package Jcode::Unicode::Constants; @@ -38,7 +38,7 @@ Copyright (c) 1991-1994 Unicode, Inc. use strict; use vars qw($RCSID $VERSION); -$RCSID = q$Id: Constants.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp dankogai $; +$RCSID = q$Id: Constants.pm,v 1.2 2001/05/18 05:14:38 dankogai Exp $; $VERSION = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use Carp; |
