[TYPO3-dev] how to set the charset correctly to UTF-8

Jigal van Hemert jigal at xs4all.nl
Sat Jan 7 17:35:04 CET 2012


Hi,

On 6-1-2012 18:42, Franz Holzinger wrote:
> On 05/01/12 13:52, Franz Holzinger wrote:
>> I have checked the file localconf.php. There have been entries like
>> this: I did not run your script.
>>
>> $TYPO3_CONF_VARS['SYS']['setDBinit'] = '';
>> $TYPO3_CONF_VARS['BE']['forceCharset'] = '';
>>
>> This has been inserted automatically by the Install Tool. When I remove
>> it: So there is a bug in the Install Tool.

This is an incorrect conclusion. The Install Tool upgrade wizard will 
detect that the setting was / settings were empty. This can be the 
situation in pre-4.5 installation, and in 4.5 the default was changed to 
UTF-8. The Upgrade wizard will show the message:
----------------
The configuration variables $TYPO3_CONF_VARS['SYS']['setDBinit'] and/or 
$TYPO3_CONF_VARS['BE']['forceCharset'] are relying on empty default values.
However, the defaults for both values have changed in TYPO3 4.5.

Please click "Next" to write the former default settings to your 
localconf.php, so that your setup will continue to work like before.
----------------

This will set the missing value to an empty value (as you've noticed) to 
make it compatible with the previous situation (with a non-UTF-8 
database and/or backend).

If you have a UTF-8 database you should have setDBinit = 'SET NAMES 
utf8;', with an empty value you should see an entry in the deprecation log:
----------------
This TYPO3 installation is using the 
$TYPO3_CONF_VARS['SYS']['setDBinit'] property with the following value:

It looks like UTF-8 is not used for this connection.

Everything other than UTF-8 is deprecated since TYPO3 4.5.

The DB, its connection and TYPO3 should be migrated to UTF-8 therefore. 
Please check your setup.
-----------------

The situation for [BE][forceCharset] is partly similar. The Upgrade 
Wizard will set missing values to an empty value in an attempt to be 
compatible with a pre-4.5 installation.
During initialization config_default.php will change empty values (-1 is 
used for empty) to 'utf-8'.
This setting will be removed in 4.7, where the backend will be only utf-8.

Short conclusion:
for 4.6 you should have
$TYPO3_CONF_VARS['SYS']['setDBinit'] = 'SET NAMES utf8;';
$TYPO3_CONF_VARS['BE']['forceCharset'] = 'utf-8';

-- 
Kind regards / met vriendelijke groet,

Jigal van Hemert.



More information about the TYPO3-dev mailing list