| 526 |
if ($char_stream) { # if supported |
if ($char_stream) { # if supported |
| 527 |
## "Change the encoding" algorithm: |
## "Change the encoding" algorithm: |
| 528 |
|
|
| 529 |
## Step 1 |
## Step 2 (HTML5 revision 3205) |
| 530 |
|
if (defined $self->{input_encoding} and |
| 531 |
|
Message::Charset::Info->get_by_html_name ($self->{input_encoding}) |
| 532 |
|
->{category} & Message::Charset::Info::CHARSET_CATEGORY_UTF16 ()) { |
| 533 |
|
$self->{confident} = 1; |
| 534 |
|
return; |
| 535 |
|
} |
| 536 |
|
|
| 537 |
|
## Step 3 |
| 538 |
if ($charset->{category} & |
if ($charset->{category} & |
| 539 |
Message::Charset::Info::CHARSET_CATEGORY_UTF16 ()) { |
Message::Charset::Info::CHARSET_CATEGORY_UTF16 ()) { |
| 540 |
$charset = Message::Charset::Info->get_by_html_name ('utf-8'); |
$charset = Message::Charset::Info->get_by_html_name ('utf-8'); |
| 544 |
} |
} |
| 545 |
$charset_name = $charset->get_iana_name; |
$charset_name = $charset->get_iana_name; |
| 546 |
|
|
| 547 |
## Step 2 |
## Step 1 XXX |
| 548 |
if (defined $self->{input_encoding} and |
if (defined $self->{input_encoding} and |
| 549 |
$self->{input_encoding} eq $charset_name) { |
$self->{input_encoding} eq $charset_name) { |
| 550 |
!!!parse-error (type => 'charset label:matching', |
!!!parse-error (type => 'charset label:matching', |
| 560 |
level => $self->{level}->{warn}, |
level => $self->{level}->{warn}, |
| 561 |
token => $token); |
token => $token); |
| 562 |
|
|
| 563 |
## Step 3 |
## Step 4 |
| 564 |
# if (can) { |
# if (can) { |
| 565 |
## change the encoding on the fly. |
## change the encoding on the fly. |
| 566 |
#$self->{confident} = 1; |
#$self->{confident} = 1; |
| 567 |
#return; |
#return; |
| 568 |
# } |
# } |
| 569 |
|
|
| 570 |
## Step 4 |
## Step 5 |
| 571 |
throw Whatpm::HTML::RestartParser (); |
throw Whatpm::HTML::RestartParser (); |
| 572 |
} |
} |
| 573 |
}; # $self->{change_encoding} |
}; # $self->{change_encoding} |