| @@ 10531-10542 (lines=12) @@ | ||
| 10528 | $encoding[] = 'UTF-8'; |
|
| 10529 | } |
|
| 10530 | // UTF-32 Big Endian Without BOM |
|
| 10531 | elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C") |
|
| 10532 | { |
|
| 10533 | if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E")) |
|
| 10534 | { |
|
| 10535 | $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'))); |
|
| 10536 | if ($parser->parse()) |
|
| 10537 | { |
|
| 10538 | $encoding[] = $parser->encoding; |
|
| 10539 | } |
|
| 10540 | } |
|
| 10541 | $encoding[] = 'UTF-32BE'; |
|
| 10542 | } |
|
| 10543 | // UTF-32 Little Endian Without BOM |
|
| 10544 | elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00") |
|
| 10545 | { |
|
| @@ 10544-10555 (lines=12) @@ | ||
| 10541 | $encoding[] = 'UTF-32BE'; |
|
| 10542 | } |
|
| 10543 | // UTF-32 Little Endian Without BOM |
|
| 10544 | elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00") |
|
| 10545 | { |
|
| 10546 | if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00")) |
|
| 10547 | { |
|
| 10548 | $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'))); |
|
| 10549 | if ($parser->parse()) |
|
| 10550 | { |
|
| 10551 | $encoding[] = $parser->encoding; |
|
| 10552 | } |
|
| 10553 | } |
|
| 10554 | $encoding[] = 'UTF-32LE'; |
|
| 10555 | } |
|
| 10556 | // UTF-16 Big Endian Without BOM |
|
| 10557 | elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C") |
|
| 10558 | { |
|
| @@ 10557-10568 (lines=12) @@ | ||
| 10554 | $encoding[] = 'UTF-32LE'; |
|
| 10555 | } |
|
| 10556 | // UTF-16 Big Endian Without BOM |
|
| 10557 | elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C") |
|
| 10558 | { |
|
| 10559 | if ($pos = strpos($data, "\x00\x3F\x00\x3E")) |
|
| 10560 | { |
|
| 10561 | $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'))); |
|
| 10562 | if ($parser->parse()) |
|
| 10563 | { |
|
| 10564 | $encoding[] = $parser->encoding; |
|
| 10565 | } |
|
| 10566 | } |
|
| 10567 | $encoding[] = 'UTF-16BE'; |
|
| 10568 | } |
|
| 10569 | // UTF-16 Little Endian Without BOM |
|
| 10570 | elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00") |
|
| 10571 | { |
|
| @@ 10570-10581 (lines=12) @@ | ||
| 10567 | $encoding[] = 'UTF-16BE'; |
|
| 10568 | } |
|
| 10569 | // UTF-16 Little Endian Without BOM |
|
| 10570 | elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00") |
|
| 10571 | { |
|
| 10572 | if ($pos = strpos($data, "\x3F\x00\x3E\x00")) |
|
| 10573 | { |
|
| 10574 | $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'))); |
|
| 10575 | if ($parser->parse()) |
|
| 10576 | { |
|
| 10577 | $encoding[] = $parser->encoding; |
|
| 10578 | } |
|
| 10579 | } |
|
| 10580 | $encoding[] = 'UTF-16LE'; |
|
| 10581 | } |
|
| 10582 | // US-ASCII (or superset) |
|
| 10583 | elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C") |
|
| 10584 | { |
|
| @@ 10583-10594 (lines=12) @@ | ||
| 10580 | $encoding[] = 'UTF-16LE'; |
|
| 10581 | } |
|
| 10582 | // US-ASCII (or superset) |
|
| 10583 | elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C") |
|
| 10584 | { |
|
| 10585 | if ($pos = strpos($data, "\x3F\x3E")) |
|
| 10586 | { |
|
| 10587 | $parser = $registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5))); |
|
| 10588 | if ($parser->parse()) |
|
| 10589 | { |
|
| 10590 | $encoding[] = $parser->encoding; |
|
| 10591 | } |
|
| 10592 | } |
|
| 10593 | $encoding[] = 'UTF-8'; |
|
| 10594 | } |
|
| 10595 | // Fallback to UTF-8 |
|
| 10596 | else |
|
| 10597 | { |
|