243 |
$self->{should_level} = 's'; |
$self->{should_level} = 's'; |
244 |
$self->{good_level} = 'w'; |
$self->{good_level} = 'w'; |
245 |
$self->{info_level} = 'i'; |
$self->{info_level} = 'i'; |
246 |
$self->{unsupported_lavel} = 'u'; |
$self->{unsupported_level} = 'u'; |
247 |
|
|
248 |
my $docel = $doc->document_element; |
my $docel = $doc->document_element; |
249 |
unless (defined $docel) { |
unless (defined $docel) { |
293 |
require Message::Charset::Info; |
require Message::Charset::Info; |
294 |
my $charset = $Message::Charset::Info::IANACharset->{$charset_name}; |
my $charset = $Message::Charset::Info::IANACharset->{$charset_name}; |
295 |
|
|
296 |
if ($doc->manakai_is_html and |
if ($doc->manakai_is_html) { |
297 |
not $doc->manakai_has_bom and |
if (not $doc->manakai_has_bom and |
298 |
not defined $doc->manakai_charset) { |
not defined $doc->manakai_charset) { |
299 |
unless ($charset->{is_html_ascii_superset}) { |
unless ($charset->{is_html_ascii_superset}) { |
300 |
$onerror->(node => $doc, level => $self->{must_level}, |
$onerror->(node => $doc, level => $self->{must_level}, |
301 |
type => 'non ascii superset:'.$charset_name); |
type => 'non ascii superset:'.$charset_name); |
302 |
|
} |
303 |
|
|
304 |
|
if (not $self->{has_charset} and ## TODO: This does not work now. |
305 |
|
not $charset->{iana_names}->{'us-ascii'}) { |
306 |
|
$onerror->(node => $doc, level => $self->{must_level}, |
307 |
|
type => 'no character encoding declaration:'.$charset_name); |
308 |
|
} |
309 |
} |
} |
|
|
|
|
if (not $self->{has_charset} and ## TODO: This does not work now. |
|
|
not $charset->{iana_names}->{'us-ascii'}) { |
|
|
$onerror->(node => $doc, level => $self->{must_level}, |
|
|
type => 'no character encoding declaration:'.$charset_name); |
|
|
} |
|
|
} |
|
310 |
|
|
311 |
if ($charset->{iana_names}->{'utf-8'}) { |
if ($charset->{iana_names}->{'utf-8'}) { |
312 |
# |
# |
313 |
} elsif ($charset->{iana_names}->{'jis_x0212-1990'} or |
} elsif ($charset->{iana_names}->{'jis_x0212-1990'} or |
314 |
$charset->{iana_names}->{'x-jis0208'} or |
$charset->{iana_names}->{'x-jis0208'} or |
315 |
$charset->{iana_names}->{'utf-32'} or ## ISSUE: UTF-32BE? UTF-32LE? |
$charset->{iana_names}->{'utf-32'} or ## ISSUE: UTF-32BE? UTF-32LE? |
316 |
$charset->{is_ebcdic_based}) { |
$charset->{is_ebcdic_based}) { |
317 |
$onerror->(node => $doc, |
$onerror->(node => $doc, |
318 |
type => 'character encoding:'.$charset_name, |
type => 'character encoding:'.$charset_name, |
319 |
level => $self->{should_level}); |
level => $self->{should_level}); |
320 |
} elsif ($charset->{iana_names}->{'cesu-8'} or |
} elsif ($charset->{iana_names}->{'cesu-8'} or |
321 |
$charset->{iana_names}->{'utf-8'} or ## ISSUE: UNICODE-1-1-UTF-7? |
$charset->{iana_names}->{'utf-8'} or ## ISSUE: UNICODE-1-1-UTF-7? |
322 |
$charset->{iana_names}->{'bocu-1'} or |
$charset->{iana_names}->{'bocu-1'} or |
323 |
$charset->{iana_names}->{'scsu'}) { |
$charset->{iana_names}->{'scsu'}) { |
324 |
$onerror->(node => $doc, |
$onerror->(node => $doc, |
325 |
type => 'character encoding:'.$charset_name, |
type => 'character encoding:'.$charset_name, |
326 |
level => $self->{must_level}); |
level => $self->{must_level}); |
327 |
} else { |
} else { |
328 |
$onerror->(node => $doc, |
$onerror->(node => $doc, |
329 |
type => 'character encoding:'.$charset_name, |
type => 'character encoding:'.$charset_name, |
330 |
level => $self->{good_level}); |
level => $self->{good_level}); |
331 |
|
} |
332 |
} |
} |
333 |
} elsif ($doc->manakai_is_html) { |
} elsif ($doc->manakai_is_html) { |
334 |
## NOTE: MUST and SHOULD requirements above cannot be tested, |
## NOTE: MUST and SHOULD requirements above cannot be tested, |
354 |
$self->{should_level} = 's'; |
$self->{should_level} = 's'; |
355 |
$self->{good_level} = 'w'; |
$self->{good_level} = 'w'; |
356 |
$self->{info_level} = 'i'; |
$self->{info_level} = 'i'; |
357 |
$self->{unsupported_lavel} = 'u'; |
$self->{unsupported_level} = 'u'; |
358 |
|
|
359 |
$self->{plus_elements} = {}; |
$self->{plus_elements} = {}; |
360 |
$self->{minus_elements} = {}; |
$self->{minus_elements} = {}; |