[TYPO3-dev] how to set the charset correctly to UTF-8
Franz Holzinger
franz at ttproducts.de
Mon Jan 2 09:05:28 CET 2012
Hello,
when I want to set a homepage to UTF-8, I discover some problems.
I have already read the wiki page
http://wiki.typo3.org/UTF-8_support
The line
$TYPO3_CONF_VARS['BE']['forceCharset'] = 'utf-8';
has been set to deprecated since TYPO3 4.5. So I added this as a note to
the wiki.
If I use [SYS][setDBinit] = SET NAMES utf8;
then the characters are wrong in the BE and FE:
über instead of über
höher instead of höher
läÃt instead of läßt
All collations are set to 'utf8_general_ci'. phpMyAdmin shows all umlaut
characters correctly. So this means that the characters must be stored
correctly in the database table.
$TYPO3_CONF_VARS['SYS']['t3lib_cs_convMethod'] = 'iconv';
$TYPO3_CONF_VARS['SYS']['t3lib_cs_utils'] = 'iconv';
I do not know what is wrong. Because on another site I must set "SET
NAMES utf8;" to get the UTF-8 characters shown..
Setup:
page.config {
metaCharset = utf-8
}
# set the TYPO3 language to german
config.language = de
# set the PHP locale to german
config.locale_all = de_DE
In tt_products I had to do a character conversion for the data entered
into the fields: (tt_products/view/class.tx_ttproducts_info_view.php)
foreach ($infoFields as $k => $fName) {
if (!in_array($fName, $selectInfoFields)) {
$fieldMarker = strtoupper($fName);
$markerArray['###PERSON_' . $fieldMarker . '###'] =
$TSFE->csConv($this->infoArray['billing'][$fName], $TSFE->metaCharset);
$markerArray['###DELIVERY_' . $fieldMarker . '###'] =
$TSFE->csConv($this->infoArray['delivery'][$fName], $TSFE->metaCharset);
}
}
But why is this needed? On some sites the character conversion must be
removed. The 'recs' is converted into another charset than UTF-8.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
...
<tr>
<td><span
class="tx-ttproducts-pi1-wrap1"><strong>Anrede:</strong></span></td>
<td><span class="tx-ttproducts-pi1-wrap1"><select
name="recs[personinfo][salutation]"
id="field_personinfo_salutation"><option value="0">Herr</option><option
value="1">Fräulein</option><option value="2">Frau</option><option
value="3">An</option></select></span></td>
</tr>
<tr>
<td><span class="tx-ttproducts-pi1-wrap1"><strong>Name:
</strong></span></td>
<td><input type="text" name="recs[personinfo][name]" size="30"
value=""></td>
</tr>
<tr>
<td><span class="tx-ttproducts-pi1-wrap1"><strong>Firma:
</strong></span></td>
<td><input type="text" name="recs[personinfo][company]" size="30"
value=""></td>
</tr>
<tr>
<td><span class="tx-ttproducts-pi1-wrap1"><strong>Adresse:
</strong></span></td>
<td><textarea cols=30 rows=5 name="recs[personinfo][address]"
wrap="off"></textarea></td>
</tr>
<tr>
<td><span class="tx-ttproducts-pi1-wrap1"><strong>PLZ: </strong></span></td>
<td><input type="text" name="recs[personinfo][zip]" size="5" value=""></td>
</tr>
<tr>
<td><span class="tx-ttproducts-pi1-wrap1"><strong>Stadt:
</strong></span></td>
<td><input type="text" name="recs[personinfo][city]" size="50"
value=""></td>
</tr>
<tr>
<td><span class="tx-ttproducts-pi1-wrap1"><strong>Land:
</strong></span></td>
<td><select size="1" id="field_personinfo_country_code"
name="recs[personinfo][country_code]" onchange="this.form.submit();">
...
- Franz
More information about the TYPO3-dev
mailing list