[BUGFIX] Use UTF-8 by default in Flexforms and Backend
authorBenjamin Mack <benni@typo3.org>
Tue, 9 Oct 2012 14:36:10 +0000 (16:36 +0200)
committerDmitry Dulepov <dmitry@typo3.org>
Mon, 15 Oct 2012 11:47:05 +0000 (13:47 +0200)
For FlexForm tools (used internally) and for backend
use, the encoding is always utf-8, so some checks
can be removed and functions can be deprecated.

Change-Id: I2a83b155d164ce5c4076b06bfbc219d7dd09fc38
Releases: 6.0
Resolves: #41793
Reviewed-on: http://review.typo3.org/15446
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php
typo3/sysext/core/Classes/Utility/File/BasicFileUtility.php

index defa3ca..2ab0bbc 100644 (file)
@@ -246,12 +246,10 @@ class DocumentTemplate {
         */
        public $parseTimeFlag = 0;
 
-       // INTERNAL
-       // Default charset. see function initCharset()
        /**
-        * @todo Define visibility
+        * internal character set, nowadays utf-8 for everything
         */
-       public $charset = 'utf-8';
+       protected $charset = 'utf-8';
 
        // Internal: Indicates if a <div>-output section is open
        /**
@@ -737,7 +735,6 @@ class DocumentTemplate {
                        }
                }
                // Send HTTP header for selected charset. Added by Robert Lemke 23.10.2003
-               $this->initCharset();
                header('Content-Type:text/html;charset=' . $this->charset);
                // Standard HTML tag
                $htmlTag = '<html xmlns="http://www.w3.org/1999/xhtml">';
@@ -1236,10 +1233,10 @@ class DocumentTemplate {
         *
         * @return string <meta> tag with charset from $this->charset or $GLOBALS['LANG']->charSet
         * @todo Define visibility
+        * @deprecated since TYPO3 6.0, remove in 6.2. The charset is utf-8 all the time for the backend now
         */
        public function initCharset() {
-               // Set charset to the charset provided by the current backend users language selection:
-               $this->charset = $GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : $this->charset;
+               \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
                // Return meta tag:
                return '<meta http-equiv="Content-Type" content="text/html; charset=' . $this->charset . '" />';
        }
index 4fd009f..f8d17e1 100644 (file)
@@ -408,7 +408,7 @@ class FlexFormTools {
                $spaceInd = $GLOBALS['TYPO3_CONF_VARS']['BE']['compactFlexFormXML'] ? -1 : 4;
                $output = \TYPO3\CMS\Core\Utility\GeneralUtility::array2xml($array, '', 0, 'T3FlexForms', $spaceInd, $options);
                if ($addPrologue) {
-                       $output = '<?xml version="1.0" encoding="' . $GLOBALS['LANG']->charSet . '" standalone="yes" ?>' . LF . $output;
+                       $output = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>' . LF . $output;
                }
                return $output;
        }
index e90eabc..52a00d7 100644 (file)
@@ -258,11 +258,8 @@ class LocalDriver extends \TYPO3\CMS\Core\Resource\Driver\AbstractDriver {
                        if (!$charset) {
                                if (TYPO3_MODE === 'FE') {
                                        $charset = $GLOBALS['TSFE']->renderCharset;
-                               } elseif (is_object($GLOBALS['LANG'])) {
-                                       // BE assumed:
-                                       $charset = $GLOBALS['LANG']->charSet;
                                } else {
-                                       // best guess
+                                       // default for Backend
                                        $charset = 'utf-8';
                                }
                        }
index 048f1ce..5490741 100644 (file)
@@ -517,11 +517,8 @@ class BasicFileUtility {
                        if (!$charset) {
                                if (TYPO3_MODE == 'FE') {
                                        $charset = $GLOBALS['TSFE']->renderCharset;
-                               } elseif (is_object($GLOBALS['LANG'])) {
-                                       // BE assumed:
-                                       $charset = $GLOBALS['LANG']->charSet;
                                } else {
-                                       // best guess
+                                       // Backend
                                        $charset = 'utf-8';
                                }
                        }