From c2369a740dff0655ed87df228a787d9ea839d080 Mon Sep 17 00:00:00 2001 From: AkibaWolf Date: Sat, 20 Feb 2016 21:31:21 +0500 Subject: [PATCH] Update PageRepo.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix encoding problem. By default DOMDocument::loadHTML treats a string as being encoded with ISO-8859-1. This causes a problem with saving cyrillic pages' text that becomes completely unreadable (like Проверка instead of normal symbols). --- app/Repos/PageRepo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Repos/PageRepo.php b/app/Repos/PageRepo.php index 05052432e..93f80ec6d 100644 --- a/app/Repos/PageRepo.php +++ b/app/Repos/PageRepo.php @@ -125,7 +125,7 @@ class PageRepo if($htmlText == '') return $htmlText; libxml_use_internal_errors(true); $doc = new \DOMDocument(); - $doc->loadHTML($htmlText); + $doc->loadHTML(mb_convert_encoding($htmlText, 'HTML-ENTITIES', 'UTF-8')); $container = $doc->documentElement; $body = $container->childNodes->item(0); @@ -359,4 +359,4 @@ class PageRepo } -} \ No newline at end of file +}