[TYPO3-core] declare(encoding='UTF-8'); in extension config files
Jigal van Hemert
jigal.van.hemert at typo3.org
Mon Feb 25 12:21:20 CET 2013
Hi,
On 25-2-2013 11:59, Dmitry Dulepov wrote:
> Jigal van Hemert wrote:
>>
>> I agree with Helmut and would even go a step further and declare them as
>> not allowed in all PHP source files. IMO there is not need for them
>> because the CGL already mentions:
>> "All TYPO3 source files use the UTF-8 character set without byte order
>> mark (BOM) since version 4.5." [1]
>>
>> Extensions should follow the CGL too.
>
> +1, however I would not bet that every ext author will read that. Having
> a fail safe measure never hurts...
The fail safe is in this case the source of more problems [1]:
" The encoding declare value is ignored in PHP 5.3 unless php is
compiled with --enable-zend-multibyte.
Note that PHP does not expose whether --enable-zend-multibyte was used
to compile PHP other than by phpinfo()."
In other words, if you have a PHP scripts with mixed encoding PHP 5.3
will not correct the encoding during the combining process if PHP wasn't
compiled with --enable-zend-multibyte. It is furthermore not possible to
detect if this feature was enabled (other then by parsing the output of
phpinfo().
Because it's not reasonably possible to see if an installation supports
encoding declarations we should IMO not allow other encodings than UTF-8
in PHP source files. Maybe it could be allowed in TYPO3 releases which
require PHP 5.4 or later.
[1] http://php.net/declare
--
Jigal van Hemert
TYPO3 Core Team member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the TYPO3-team-core
mailing list