332 |
}; # $c1_entity_char |
}; # $c1_entity_char |
333 |
|
|
334 |
sub parse_byte_string ($$$$;$) { |
sub parse_byte_string ($$$$;$) { |
335 |
|
my $self = shift; |
336 |
|
my $charset_name = shift; |
337 |
|
open my $input, '<', ref $_[0] ? $_[0] : \($_[0]); |
338 |
|
return $self->parse_byte_stream ($charset_name, $input, @_[1..$#_]); |
339 |
|
} # parse_byte_string |
340 |
|
|
341 |
|
sub parse_byte_stream ($$$$;$) { |
342 |
my $self = ref $_[0] ? shift : shift->new; |
my $self = ref $_[0] ? shift : shift->new; |
343 |
my $charset_name = shift; |
my $charset_name = shift; |
344 |
open my $byte_stream, '<', ref $_[0] ? $_[0] : \($_[0]); |
my $byte_stream = $_[0]; |
345 |
|
|
346 |
my $onerror = $_[2] || sub { |
my $onerror = $_[2] || sub { |
347 |
my (%opt) = @_; |
my (%opt) = @_; |
553 |
$return = $self->parse_char_stream ($char_stream, @args); |
$return = $self->parse_char_stream ($char_stream, @args); |
554 |
}; |
}; |
555 |
return $return; |
return $return; |
556 |
} # parse_byte_string |
} # parse_byte_stream |
557 |
|
|
558 |
## NOTE: HTML5 spec says that the encoding layer MUST NOT strip BOM |
## NOTE: HTML5 spec says that the encoding layer MUST NOT strip BOM |
559 |
## and the HTML layer MUST ignore it. However, we does strip BOM in |
## and the HTML layer MUST ignore it. However, we does strip BOM in |