[TYPO3-english] converting to utf-8

Jigal van Hemert jigal at xs4all.nl
Wed May 26 06:59:39 CEST 2010


Katja Lampela wrote:
> I'm looking for a way to convert existing site from iso-8859-1 to utf-8.
> I get all the pages and page contents nicely converted (after changing 
> the charset in install tool) with the extension convert2utf8. But it 
> doesn't convert tt_news records.

Back in 2008 I wrote a standalone script to convert the tables and 
columns in a MySQL database to utf-8. [1]

Read the following very carefully, because you have to make a few 
adjustments depending on the situation!

- the script was meant for the situation where utf-8 encoded data was 
stored in latin-1 (or other charsets) tables. This was very common then. 
You can recognize this by looking in PHPmyAdmin and you find that 
characters with accents (diacriticals) are shown as weird 
double-character combinations:
instead of "Ali Gökgöz and Gültekin Tarcan" it shows as "Ali Gökgöz 
and Gültekin Tarcan".
If this is *not* the case in your situation, turn lines 97 - 107 into 
comments by putting // in front of them.

- in line 19 of the script it says define("SIMULATE", TRUE); This makes 
sure that the tables are not really converted, it's just a practice run; 
a simulation. After you executed the script at least once and there are 
no errors you can turn this into define("SIMULATE", FALSE); to do the 
conversion for real.

- put the script in a subdirectory of the TYPO3 installation, for 
example inside 'fileadmin'. It is designed to run from a subdirectory so 
it can pick up the database connection data from localconf.php

- run the script from your browser: 
http://domain.ext/fileadmin/db_utf8_fix.php It shows each table it found 
and after the name of a table a dot for each column it has converted.

- it really doesn't matter if there are columns/tables already in utf-8 
format

- make a backup of your database before you do such a conversion

[1] http://www.xs4all.nl/~dcbjht/typo3/db_utf8_fix.zip

-- 
Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh


More information about the TYPO3-english mailing list