From 952588ee1f883ec6ac0993a5916747ee30c42046 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 27 Mar 2026 20:34:45 +0100 Subject: [PATCH] Fix bad encoding for `tidy_repair_string` Tidy on PHP 8.5 is more restrictive on what can be given as input encoding. Before, it worked as an unknown value was converted to `utf8`. --- src/Readability.php | 2 +- tests/ReadabilityTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Readability.php b/src/Readability.php index bb9e9f6..92314c5 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -118,7 +118,7 @@ class Readability implements LoggerAwareInterface 'enclose-text' => true, 'merge-divs' => true, // 'merge-spans' => true, - 'input-encoding' => '????', + 'input-encoding' => 'utf8', 'output-encoding' => 'utf8', 'hide-comments' => true, ]; diff --git a/tests/ReadabilityTest.php b/tests/ReadabilityTest.php index df8a13b..6e6e448 100644 --- a/tests/ReadabilityTest.php +++ b/tests/ReadabilityTest.php @@ -17,6 +17,7 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase public function testConstructDefault() { $readability = $this->getReadability(''); + $this->assertSame('utf8', $readability->tidy_config['input-encoding']); $this->assertNull($readability->url); $this->assertInstanceOf(\DOMDocument::class, $readability->dom);