[TYPO3-english] How can I convert my database to utf8?

Kay Strobach typo3 at kay-strobach.de
Wed Jun 2 08:34:20 CEST 2010


Hallo Jörg,

there is a small trick, that helped me out:
Drop the database after you dumped it.

mysqldump -u -p DB > dump.sql

Recreate it with Kollation utf8_general_ci (e.g. with PHPMYadmin at the
startingpage ;) - The charset is very important ...

Perhaps you need to change the collation in the dump (depends on
version) manually to utf8_general_ci ...

mysql -u -p DBnew < dump-iconv.sql

$TYPO3_CONF_VARS['SYS']['UTF8filesystem'] = '1';
$TYPO3_CONF_VARS['SYS']['setDBinit'] = 'SET NAMES utf8;\'.chr(10).\'SET
CHARACTER SET utf8;\'.chr(10).\'SET SESSION character_set_server=utf8;';
$TYPO3_CONF_VARS['BE']['forceCharset'] = 'utf-8';

Hope that helps
Best regards
Kay

Am 02.06.2010 00:41, schrieb Jörg Klein:
> Hi guys,
> 
> I want to use utf8 in my database.
> 
> What I have:
> I use a MySQL Server. character_set_xxx values are all set to utf8.
> But the database with all tables and columns uses latin1 as charset and 
> latin1_german1_ci as collation.
> I have german special characters in this database.
> Umlauts are displayed correctly in TYPO3 and in PHPMyAdmin.
> 
> What I want:
> I want to set $TYPO3_CONF_VARS['BE']['forceCharset'] = utf-8;
> According to the description in the Install Tool the database will then 
> always use utf-8 as charset.
> So I must(?) convert the DB to utf-8.
> 
> What I did:
> mysqldump -u -p DB > dump.sql
> iconv -f CP1252 -t utf8 dump.sql > dump-iconv.sql
> mysql -u -p DBnew < dump-iconv.sql
> 
> Then I set in TYPO3:
> $TYPO3_CONF_VARS['SYS']['UTF8filesystem'] = '1';
> $TYPO3_CONF_VARS['SYS']['setDBinit'] = 'SET NAMES utf8;\'.chr(10).\'SET 
> CHARACTER SET utf8;\'.chr(10).\'SET SESSION character_set_server=utf8;';
> $TYPO3_CONF_VARS['BE']['forceCharset'] = 'utf-8';
> 
> Result:
> Special chars are OK when displayed in TYPO3.
> But they are broken in PHPMyAdmin:
> E.g. instead of ü I get ÃŒ.
> (And according to PHPMyAdmin charset and collation are still latin1.)
> 
> If I change charset and collation in dump.sql (replacing the CHARSET and 
> COLLATE statements) the error is just the other way around:
> Special chars are broken in TYPO3: I get a small black box with a question 
> mark in it.
> In PHPMyAdmin they are OK.
> 
> What shall I do?
> 
> Greetings
> 
> Jörg 
> 
> 



More information about the TYPO3-english mailing list