#!/bin/bash
echo "needed parameters are: dbname username [password]"
echo "will convert DB \"$1\" with user \"$2\""
echo "press enter to continue"
read

# script according to http://wiki.typo3.org/UTF-8_support#convert_databases_to_utf8
echo ALTER DATABASE $1 CHARACTER SET
echo "ALTER DATABASE $1 CHARACTER SET utf8 COLLATE utf8_general_ci;" | mysql -u $2 -p$3
echo mysqldump
#                                            v---- here insert utf8 if utf8 is stored in latin-fields
#                                            v---- hier utf8 eintragen wenn utf8 in latin-feldern gespeichert ist
mysqldump -u $2 -p$3 --default-character-set=latin1 --databases $1 > $1.orig.sql
echo copy
cp $1.orig.sql $1.temp.sql
echo DEFAULT CHARSET
sed -i 's/DEFAULT CHARSET=latin1/DEFAULT CHARSET=utf8/gI' $1.temp.sql
echo SET NAMES 
sed -i 's/SET NAMES latin1/SET NAMES utf8/gI' $1.temp.sql
echo CHARACTER SET
sed -i 's/CHARACTER SET latin1/CHARACTER SET utf8/gI' $1.temp.sql

echo "latin1_german[12]_ci -\> utf8"
sed -i 's/COLLATE latin1_german[12]_ci/COLLATE utf8_unicode_ci/gI' $1.temp.sql
echo \*
sed -i 's/COLLATE=latin1_german[12]_ci/COLLATE=utf8_unicode_ci/gI' $1.temp.sql

echo "latin1_swedish_ci -\> utf8"
sed -i 's/COLLATE latin1_swedish_ci/COLLATE utf8_unicode_ci/gI' $1.temp.sql
echo \*
sed -i 's/COLLATE=latin1_swedish_ci/COLLATE=utf8_unicode_ci/gI' $1.temp.sql

#echo InnoDb
#sed -i 's/ENGINE=MyISAM/ENGINE=InnoDb/g' $1.new.sql
echo character_set_client
grep -v character_set_client <$1.temp.sql > $1.new.sql
echo remove temp
rm $1.temp.sql
echo reload
mysql -u $2 -p$3 --default-character-set=utf8 $1 < $1.new.sql
echo zip sql
# store just in case we might need them if something goes wrong
gzip $1.orig.sql
echo \*
gzip $1.new.sql
echo done!

 

 

danach sollte es (ab 4.5) komplett ohne die Einträge

$TYPO3_CONF_VARS['SYS']['setDBinit'] 
$TYPO3_CONF_VARS['BE']['forceCharset']

in der localconf.php gehen.

 

Ansonsten die Defaultwerte

$TYPO3_CONF_VARS['SYS']['setDBinit'] = 'SET NAMES utf8;';
$TYPO3_CONF_VARS['BE']['forceCharset'] = 'utf-8';

setzen.

 
Ihre aktuelle Seitenauswahl:  
>>>