From 6586626ac878e99b9e3f5f15ac5ec37cd7484831 Mon Sep 17 00:00:00 2001 From: in2 Date: Tue, 16 Dec 2003 06:51:38 +0000 Subject: better big5=>gb2312 implementation git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1415 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- staticweb/man.pl | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'staticweb/man.pl') diff --git a/staticweb/man.pl b/staticweb/man.pl index 6afb7410..003f7ebf 100755 --- a/staticweb/man.pl +++ b/staticweb/man.pl @@ -59,7 +59,17 @@ sub main $rh->{lang} = 'zh_TW'; $rh->{charset} = 'big5'; } - $tmpl->process($rh->{tmpl}, $rh); + + if( !$rh->{gb} ){ + $tmpl->process($rh->{tmpl}, $rh); + } + else{ + my $output; + $tmpl->process($rh->{tmpl}, $rh, \$output); + b2g::big5togb($output); + print $output; + } + untie %db; } @@ -71,8 +81,6 @@ sub dirmode compress => 0, ); foreach( @{$serial->deserialize($db{$fpath}) || []} ){ - $_->[1] =~ s/([\xA1-\xF9].)/$b2g{$1}/eg if( $isgb ); - #Encode::from_to($_->[1], 'big5', 'gbk') if( $isgb ); $isdir = (($_->[0] =~ m|/$|) ? 1 : 0); push @{$th{dat}}, {isdir => $isdir, fn => "man.pl/$brdname$_->[0]", @@ -108,8 +116,6 @@ sub articlemode $th{content} =~ s|ptt\.twbbs\.org|ptt.twbbs.org|gs; - $th{content} =~ s/([\xA1-\xF9].)/$b2g{$1}/eg if( $isgb ); - #Encode::from_to($th{content}, 'big5', 'gbk') if( $isgb ); return \%th; } -- cgit v1.2.3