[BUGFIX] Fix checking config.metaCharset with uppercase letters 91/53291/3
authorStephan Großberndt <stephan@grossberndt.de>
Tue, 20 Jun 2017 16:25:56 +0000 (18:25 +0200)
committerBenni Mack <benni@typo3.org>
Wed, 21 Jun 2017 04:27:07 +0000 (06:27 +0200)
Releases: master, 8.7
Resolves: #81634
Change-Id: I48bc1885aec47a4dcc66bf556cd69d50a7781fd5
Reviewed-on: https://review.typo3.org/53291
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stephan Großberndt <stephan@grossberndt.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/indexed_search/Classes/FileContentParser.php
typo3/sysext/indexed_search/Classes/Indexer.php

index b0d7d1f..867c482 100644 (file)
@@ -2089,7 +2089,7 @@ class ContentObjectRenderer
     public function stdWrap_csConv($content = '', $conf = [])
     {
         if (!empty($conf['csConv'])) {
-            $output = mb_convert_encoding($content, 'utf-8', $conf['csConv']);
+            $output = mb_convert_encoding($content, 'utf-8', trim(strtolower($conf['csConv'])));
             return $output !== false && $output !== '' ? $output : $content;
         } else {
             return $content;
@@ -2288,7 +2288,7 @@ class ContentObjectRenderer
         $content = (string)$content === '' ? $GLOBALS['EXEC_TIME'] : (int)$content;
         $content = $conf['strftime.']['GMT'] ? gmstrftime($conf['strftime'], $content) : strftime($conf['strftime'], $content);
         if (!empty($conf['strftime.']['charset'])) {
-            $output = mb_convert_encoding($content, 'utf-8', $conf['strftime.']['charset']);
+            $output = mb_convert_encoding($content, 'utf-8', trim(strtolower($conf['strftime.']['charset'])));
             return $output ?: $content;
         }
         return $content;
index dffd47e..64871db 100644 (file)
@@ -4172,7 +4172,7 @@ class TypoScriptFrontendController
 
         // Rendering charset of HTML page.
         if ($this->config['config']['metaCharset']) {
-            $this->metaCharset = $this->config['config']['metaCharset'];
+            $this->metaCharset = trim(strtolower($this->config['config']['metaCharset']));
         }
     }
 
index da964e9..d31e2a8 100644 (file)
@@ -660,7 +660,7 @@ class FileContentParser
                 $fileContent = GeneralUtility::getUrl($absFile);
                 // Finding charset:
                 preg_match('/^[[:space:]]*<\\?xml[^>]+encoding[[:space:]]*=[[:space:]]*["\'][[:space:]]*([[:alnum:]_-]+)[[:space:]]*["\']/i', substr($fileContent, 0, 200), $reg);
-                $charset = $reg[1] ?: 'utf-8';
+                $charset = $reg[1] ? trim(strtolower($reg[1])) : 'utf-8';
                 // Converting content:
                 $fileContent = $this->pObj->convertHTMLToUtf8(strip_tags(str_replace('<', ' <', $fileContent)), $charset);
                 $contentArr = $this->pObj->splitRegularContent($fileContent);
index 2070428..daeab9a 100644 (file)
@@ -674,6 +674,7 @@ class Indexer
     {
         // Find charset:
         $charset = $charset ?: $this->getHTMLcharset($content);
+        $charset = trim(strtolower($charset));
         // Convert charset:
         if ($charset && $charset !== 'utf-8') {
             $content = mb_convert_encoding($content, 'utf-8', $charset);