[TYPO3-german] Umlaute im Backend

Andreas Becker ab.becker at web.de
Tue Jul 10 16:45:50 CEST 2007


Hallo - bitte benutze doch deinen richtigen Namen - Danke

Die Fragezeichen haengen meist mit unterschiedlichen settings in deiner
Datenbank, sowie ihren tabellen, als auch deren Connections zu TYPO3,
localconf, setup zusammen. Du kannst das einfach checken, indem Du z.B. in
Firefox die Language settings aenderst und mal schaust wo die Umlaute richtg
und wo mit Fragezeichen dargestellt werden.

Hast Du zudem zuvor schon Inhalte eingefuegt gehabt und dann z.B. auf UTF8
umgestellt, so liegen die Schriftzeichen nachwievor NICHT in UTF8 in der
Datenbank. ebenso wenn Du es andersherum machst. Dann musst Du die daten
aller tabellen - also der datenbank komplett erst einmal nach UTF8
konvertieren. Das geht z.B. mit iconv.

SETUP:

// T3Pack multi-byte content; change to false for US English only sites

if ($utf8 == 'true')

{

    $TYPO3_CONF_VARS['BE']['forceCharset'] = 'utf-8';

    $TYPO3_CONF_VARS['SYS']['UTF8filesystem'] = 'true';

    $TYPO3_CONF_VARS['SYS']['multiplyDBfieldSize'] = '1';

    $TYPO3_CONF_VARS['SYS']['setDBinit'] = 'SET NAMES utf8;'.chr(10).'SET
CHARACTER SET utf8;'.chr(10).'SET SESSION character_set_server=utf8;' ;

}

// T3Pack PHP5 Settings

if ($php5 == 'true')

{

  $TYPO3_CONF_VARS['SYS']['t3lib_cs_convMethod'] = 'iconv';

  $TYPO3_CONF_VARS['SYS']['t3lib_cs_utils'] = 'iconv';

  $TYPO3_CONF_VARS['EXT']['extConf']['cooluri'] =
'a:3:{s:6:"LANGID";s:1:"L";s:7:"XMLPATH";s:33:"typo3conf/ext/abcstarter/scripts/";s:11:"MULTIDOMAIN";s:1:"1";}';

}

MYSQL:

....

....

# CLIENT SECTION

# ----------------------------------------------------------------------

#

# The following options will be read by MySQL client applications.

# Note that only client applications shipped by MySQL are guaranteed

# to read this section. If you want your own MySQL client program to

# honor these values, you need to specify it as an option during the

# MySQL client library initialization.

#

[client]

port=3306

# The default character set that will be used when a new schema or table is

# created and no character set is defined

default-character-set=utf8

# SERVER SECTION

# ----------------------------------------------------------------------

#

# The following options will be read by the MySQL Server. Make sure that

# you have installed the server correctly (see above) so it reads this

# file.

#

[mysqld]

# The TCP/IP Port the MySQL Server will listen on

port=3306

# The default character set that will be used when a new schema or table is

# created and no character set is defined

default-character-set=utf8

# The default storage engine that will be used when create new tables when

default-storage-engine=INNODB

#Path to installation directory. All paths are usually resolved relative to
this.

basedir="I:/CUSTOMER/START-T3Pack/mysql"

...

...

Das geht allerdings nur wenn Du Du die My.INI (MySQL5) oder Mv.cnf (MySql4)
zugreifen kannst

Ansonsten musst Du jedesmal wenn Du eine Datenbank NEU anlegst die
entsprechenden Werte und Collations checken/auf utf8 einstellen BEVOR du
daten einfuegst. Ebenso solltest Du das Tun BEVOR du die Datenbank die du
mit iconv konvertiert hast einfuegst.

ACHTUNG! Wenn man doppelt konvertiert, so veraendern sich logischerweise
auch jedesmal wieder die Werte der Zeichen. Bitte immer nur mit gutem Backup
experimentieren!



Hier noch ein Hinweis bzgl der Konvertierung:



typo3 sets incorrectly mysql tables at installation

I have installed typo3 (ver. 4.0.4. with php 5.1.6-5 [debian] and mysql
5.0.30-Debian_1-log) and only after some time I have realized that thought
utf-8 seem to work correctly everywhere, the instalation has set incorrectly
all collations of all db fields to default latin1_swedish_ci.

The result is that it is impossible to use the db in php connections which
are correctly set up [as utf-8]. The settings mentioned on this page
[particularly [setDBinit] String setting] sets the connection right, but
than all int. characters on front page are crippled.

The situation is that thought typo3 stores all text values in utf-8, but to
latin1 fields - so for example if you look at them in phpmyadmin they come
out incorrectly. If you want to correctly set up typo3 according to this
page you should alo convert whole database to utf8 somehow. The CONVERT TO
sql command is useless, because it tries to convert characters from latin1
to utf-8 so they finished "doubleencoded". The correct way to do it is to
convert all fields manually first to BINARY [which causes no conversion] and
than back to utf8. You can use this script for this:



<?php
if ($argc != 3 || !mysql_select_db($argv[1])) {
exit("Usage: php $argv[0] db collation\n");
}
$collation = $argv[2];
function mysql_convert($query)
{
//~ echo "$query;\n";
return mysql_query($query);
}
mysql_convert("ALTER DATABASE $argv[1] COLLATE $collation");
$result = mysql_query("SHOW TABLES");
while ($row = mysql_fetch_row($result)) {
mysql_convert("ALTER TABLE $row[0] COLLATE $collation");
$result1 = mysql_query("SHOW COLUMNS FROM $row[0]");
while ($row1 = mysql_fetch_assoc($result1)) {
if (preg_match('~char|text|enum|set~', $row1["Type"])) {
mysql_convert("ALTER TABLE $row[0] MODIFY $row1[Field] $row1[Type] CHARACTER
SET binary");
mysql_convert("ALTER TABLE $row[0] MODIFY $row1[Field] $row1[Type] COLLATE
$collation" .
($row1["Null"] ? "" : " NOT NULL") . ($row1["Default"] &&
$row1["Default"] != "NULL" ? " DEFAULT '$row1[Default]'" : ""));
}
}
}
mysql_free_result($result);
?>

this works from command line like that:

php convert.php dbase collation

also you might need to add st. like

mysql_connect("localhost","username","password");

at the beginning of the script.

The solution is translated from the Czech page
http://php.vrana.cz/prevod-kodovani-mysql.php Hope it helps.


Andi

>
>
> 1. German wurde über Extension Manager Translation Handling geladen, aber
> mit Problemen!
> Die Routine brach ab (zeigte aber "erfolgreich" an, nur nichts wurde
> deutsch) Ist als Bug bei Typo angezeigt, weil es mir nicht als einzigem so
> geht.
>
> Habe die Dateien mit Hand nach /de ausgepackt dabei kam bei zwei Dateien
> folgende Fehlermeldung:
> End-of-central-directory signature not found
> Rtehtmlarea gibt die selbe Meldung. Bricht ER deshalb die Instalation ab?
>
> 2. [BE] Forcecharset und [sys]dbinit sind auf utf-8 umgestellt (Datenbank
> auch)
>
> Die Sprache ist jetzt (außer bei den betroffen Modulen) deutsch aber
> Umlaute
> eben Fragezeichen. Und zwar in den Standard Texten von Typo3 (Backendmenü,
> Hilfetexte, Dialoge) In den "Inhalten" schreibt er soweit ich bisher
> getestet habe schön die Umlaute hin.
>
>
> Irgendwo sitzt der Wurm, aber ich finde ihn nicht,
>
> Grüsse
>
> Stubbi
>
>
> _______________________________________________
> TYPO3-german mailing list
> TYPO3-german at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-german
>


More information about the TYPO3-german mailing list