/[webpac2]/Webpacus/lib/Webpacus/Model/WebPAC.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Webpacus/lib/Webpacus/Model/WebPAC.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 167 by dpavlin, Sat Nov 26 21:11:41 2005 UTC revision 178 by dpavlin, Sun Nov 27 05:07:01 2005 UTC
# Line 119  Convert data saved to disk in Webpac enc Line 119  Convert data saved to disk in Webpac enc
119    
120  sub iconv_on_save {  sub iconv_on_save {
121          my $self = shift;          my $self = shift;
122            my $content = shift || return;
123    
124          $self->{iconv_save} ||= new Text::Iconv(          $self->{iconv_save} ||= new Text::Iconv(
125                  $self->config->{webpac}->{out_encoding},                  $self->config->{webpac}->{out_encoding},
126                  $self->config->{webpac}->{webpac_encoding},                  $self->config->{webpac}->{webpac_encoding},
127          );          );
128    
129          $self->{iconv_save}->convert( @_ );          return $self->{iconv_save}->convert( $content );
130  }  }
131    
132    
# Line 287  it over original file which should be at Line 288  it over original file which should be at
288  sub save_html {  sub save_html {
289          my ($self, $path, $content) = @_;          my ($self, $path, $content) = @_;
290    
         $content = $self->iconv_on_save( $content ) || die "no content?";  
   
291          sub _conv_js {          sub _conv_js {
292                  my $t = shift || return;                  my $t = shift || return;
293                  return $self->{iconv}->convert(chr(hex($t)));                  return $self->{iconv}->convert(chr(hex($t)));
# Line 297  sub save_html { Line 296  sub save_html {
296          $content =~ s/^[\n\r]+//s;          $content =~ s/^[\n\r]+//s;
297          $content =~ s/[\n\r]+$/\n/s;          $content =~ s/[\n\r]+$/\n/s;
298    
299            my $iconv_on_save = new Text::Iconv(
300                    $self->config->{webpac}->{out_encoding},
301                    $self->config->{webpac}->{webpac_encoding},
302            );
303            $self->{log}->debug( "content BEFORE : $content" );
304            no utf8;
305            $content = $iconv_on_save->convert( $content ) || die "no content?";
306    
307            $self->{log}->debug( "content AFTER: $content" );
308    
309          write_file($path . '.new', $content) || die "can't save ${path}.new $!";          write_file($path . '.new', $content) || die "can't save ${path}.new $!";
310          rename $path . '.new', $path || die "can't rename to $path: $!";          rename $path . '.new', $path || die "can't rename to $path: $!";
311  }  }

Legend:
Removed from v.167  
changed lines
  Added in v.178

  ViewVC Help
Powered by ViewVC 1.1.26