/[suikacvs]/markup/html/whatpm/Whatpm/HTML.pm.src
Suika

Diff of /markup/html/whatpm/Whatpm/HTML.pm.src

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

revision 1.63 by wakaba, Sun Nov 11 06:54:36 2007 UTC revision 1.64 by wakaba, Sun Nov 11 08:39:42 2007 UTC
# Line 92  sub parse_byte_string ($$$$;$) { Line 92  sub parse_byte_string ($$$$;$) {
92    my $s;    my $s;
93        
94    if (defined $charset) {    if (defined $charset) {
95      require Encode;      require Encode; ## TODO: decode(utf8) don't delete BOM
96      $s = \ (Encode::decode ($charset, $$bytes_s));      $s = \ (Encode::decode ($charset, $$bytes_s));
97      $self->{input_encoding} = lc $charset; ## TODO: normalize name ## TODO: set $doc->input_encoding      $self->{input_encoding} = lc $charset; ## TODO: normalize name
98      $self->{confident} = 1;      $self->{confident} = 1;
99    } else {    } else {
100      $s = ref $_[0] ? $_[0] : \($_[0]);      $charset = 'windows-1252'; ## TODO: for now.
101        $s = \ (Encode::decode ($charset, $$bytes_s));
102        $self->{input_encoding} = $charset;
103      $self->{confident} = 0;      $self->{confident} = 0;
104    }    }
105    
# Line 121  sub parse_byte_string ($$$$;$) { Line 123  sub parse_byte_string ($$$$;$) {
123        return;        return;
124      }      }
125    
126      !!!parse-error (type => 'charset label detected', level => 'w');      !!!parse-error (type => 'charset label detected:'.$self->{input_encoding}.
127            ':'.$charset, level => 'w');
128    
129      ## Step 3      ## Step 3
130      # if (can) {      # if (can) {
# Line 141  sub parse_byte_string ($$$$;$) { Line 144  sub parse_byte_string ($$$$;$) {
144    } catch Whatpm::HTML::RestartParser with {    } catch Whatpm::HTML::RestartParser with {
145      my $charset = shift->{charset};      my $charset = shift->{charset};
146      $s = \ (Encode::decode ($charset, $$bytes_s));          $s = \ (Encode::decode ($charset, $$bytes_s));    
147      $self->{input_encoding} = $charset; ## TODO: $doc->input_encoding;      $self->{input_encoding} = $charset; ## TODO: normalize
148      $self->{confident} = 1;      $self->{confident} = 1;
149      $return = $self->parse_char_string ($s, @args);      $return = $self->parse_char_string ($s, @args);
150    };    };
# Line 159  sub parse_string ($$$;$) { Line 162  sub parse_string ($$$;$) {
162    ## NOTE: |set_inner_html| copies most of this method's code    ## NOTE: |set_inner_html| copies most of this method's code
163    
164    $self->{confident} = 1 unless exists $self->{confident};    $self->{confident} = 1 unless exists $self->{confident};
165      $self->{document}->input_encoding ($self->{input_encoding})
166          if defined $self->{input_encoding};
167    
168    my $i = 0;    my $i = 0;
169    my $line = 1;    my $line = 1;

Legend:
Removed from v.1.63  
changed lines
  Added in v.1.64

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24