14 |
require Encode; |
require Encode; |
15 |
require Whatpm::HTML; |
require Whatpm::HTML; |
16 |
|
|
|
$self->result->layer_uncertain ('charset'); |
|
|
|
|
17 |
my $out = $self->output; |
my $out = $self->output; |
18 |
$out->start_section (role => 'parse-errors'); |
$out->start_section (role => 'parse-errors'); |
19 |
$out->start_error_list (role => 'parse-errors'); |
$out->start_error_list (role => 'parse-errors'); |
36 |
} |
} |
37 |
}; |
}; |
38 |
|
|
39 |
|
$self->result->layer_applicable ('charset'); |
40 |
|
my $char_checker = sub ($) { |
41 |
|
require Whatpm::Charset::UnicodeChecker; |
42 |
|
return Whatpm::Charset::UnicodeChecker->new_handle ($_[0]); |
43 |
|
}; # $char_checker |
44 |
|
|
45 |
my $dom = Message::DOM::DOMImplementation->new; |
my $dom = Message::DOM::DOMImplementation->new; |
46 |
my $doc = $dom->create_document; |
my $doc = $dom->create_document; |
47 |
my $el; |
my $el; |
56 |
|
|
57 |
$el = $doc->create_element_ns |
$el = $doc->create_element_ns |
58 |
('http://www.w3.org/1999/xhtml', [undef, $inner_html_element]); |
('http://www.w3.org/1999/xhtml', [undef, $inner_html_element]); |
59 |
Whatpm::HTML->set_inner_html ($el, $$t, $onerror); |
Whatpm::HTML->set_inner_html ($el, $$t, $onerror, $char_checker); |
60 |
|
|
61 |
$self->{structure} = $el; |
$self->{structure} = $el; |
62 |
$self->{_structure_root} = $doc; |
$self->{_structure_root} = $doc; |
65 |
## reference. |
## reference. |
66 |
} else { |
} else { |
67 |
if ($input->{is_char_string}) { |
if ($input->{is_char_string}) { |
68 |
Whatpm::HTML->parse_char_string ($input->{s} => $doc, $onerror); |
Whatpm::HTML->parse_char_string ($input->{s} => $doc, |
69 |
|
$onerror, $char_checker); |
70 |
} else { |
} else { |
71 |
$self->result->layer_applicable ('encode'); |
$self->result->layer_applicable ('encode'); |
72 |
Whatpm::HTML->parse_byte_string |
Whatpm::HTML->parse_byte_string |
73 |
($input->{charset}, $input->{s} => $doc, $onerror); |
($input->{charset}, $input->{s} => $doc, $onerror, $char_checker); |
74 |
} |
} |
75 |
|
|
76 |
$self->{structure} = $doc; |
$self->{structure} = $doc; |