mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 13:21:51 +00:00
Merge pull request #123 from mpyw-forks/fix/#122/surrogate-pair-range
Fix surrogate pair range
This commit is contained in:
commit
bb3f86e80a
@ -255,7 +255,7 @@ class HTMLPurifier_Encoder
|
|||||||
// 7F-9F is not strictly prohibited by XML,
|
// 7F-9F is not strictly prohibited by XML,
|
||||||
// but it is non-SGML, and thus we don't allow it
|
// but it is non-SGML, and thus we don't allow it
|
||||||
(0xA0 <= $mUcs4 && 0xD7FF >= $mUcs4) ||
|
(0xA0 <= $mUcs4 && 0xD7FF >= $mUcs4) ||
|
||||||
(0x10000 <= $mUcs4 && 0x10FFFF >= $mUcs4)
|
(0xE000 <= $mUcs4 && 0x10FFFF >= $mUcs4)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$out .= $char;
|
$out .= $char;
|
||||||
|
@ -23,6 +23,7 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
|
|||||||
$this->assertCleanUTF8('Normal string.');
|
$this->assertCleanUTF8('Normal string.');
|
||||||
$this->assertCleanUTF8("Test\tAllowed\nControl\rCharacters");
|
$this->assertCleanUTF8("Test\tAllowed\nControl\rCharacters");
|
||||||
$this->assertCleanUTF8("null byte: \0", 'null byte: ');
|
$this->assertCleanUTF8("null byte: \0", 'null byte: ');
|
||||||
|
$this->assertCleanUTF8("あ(い)う(え)お\0", "あ(い)う(え)お"); // test for issue #122
|
||||||
$this->assertCleanUTF8("\1\2\3\4\5\6\7", '');
|
$this->assertCleanUTF8("\1\2\3\4\5\6\7", '');
|
||||||
$this->assertCleanUTF8("\x7F", ''); // one byte invalid SGML char
|
$this->assertCleanUTF8("\x7F", ''); // one byte invalid SGML char
|
||||||
$this->assertCleanUTF8("\xC2\x80", ''); // two byte invalid SGML
|
$this->assertCleanUTF8("\xC2\x80", ''); // two byte invalid SGML
|
||||||
|
Loading…
Reference in New Issue
Block a user