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

Jörg Klein joerg at klein-family.com
Wed Jun 2 00:41:08 CEST 2010


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