Update PageRepo.php
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).
Showing
1 changed file
with
2 additions
and
2 deletions
| ... | @@ -125,7 +125,7 @@ class PageRepo | ... | @@ -125,7 +125,7 @@ class PageRepo |
| 125 | if($htmlText == '') return $htmlText; | 125 | if($htmlText == '') return $htmlText; |
| 126 | libxml_use_internal_errors(true); | 126 | libxml_use_internal_errors(true); |
| 127 | $doc = new \DOMDocument(); | 127 | $doc = new \DOMDocument(); |
| 128 | - $doc->loadHTML($htmlText); | 128 | + $doc->loadHTML(mb_convert_encoding($htmlText, 'HTML-ENTITIES', 'UTF-8')); |
| 129 | 129 | ||
| 130 | $container = $doc->documentElement; | 130 | $container = $doc->documentElement; |
| 131 | $body = $container->childNodes->item(0); | 131 | $body = $container->childNodes->item(0); |
| ... | @@ -359,4 +359,4 @@ class PageRepo | ... | @@ -359,4 +359,4 @@ class PageRepo |
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | 361 | ||
| 362 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 362 | +} | ... | ... |
-
Please register or sign in to post a comment