Skip to content
Permalink
Browse files

php5 fixes

  • Loading branch information...
oscarotero committed Jul 20, 2019
1 parent 4f16acf commit 960bbd5a62c5697302bd5394d58efba2e998b787
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/Utils.php
@@ -12,7 +12,7 @@
*/
class Utils
{
const ENCODINGS = [
private static $encodings = [
'ASCII' => 'ascii',
'UTF-8' => 'utf-8',
'SJIS' => 'shift_jis',
@@ -296,13 +296,13 @@ public static function parse($html)
*/
private static function normalize($string)
{
$detected = mb_detect_encoding($string, implode(',', array_keys(self::ENCODINGS)), true);
$detected = mb_detect_encoding($string, implode(',', array_keys(self::$encodings)), true);
if ($detected && isset(self::ENCODINGS[$detected])) {
if ($detected && isset(self::$encodings[$detected])) {
$string = mb_convert_encoding($string, 'HTML-ENTITIES', $detected);
$string = preg_replace(
'/<head[^>]*>/',
'<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset='.self::ENCODINGS[$detected].'">',
'<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset='.self::$encodings[$detected].'">',
$string
);
}

0 comments on commit 960bbd5

Please sign in to comment.
You can’t perform that action at this time.