[TYPO3-dev] how to set the charset correctly to UTF-8

Richard Davies richard at ocular.co.nz
Tue Jan 3 21:09:39 CET 2012


Hi,

The issue is probably that your database is defined previously as latin-1,
not UTF8. Its all well and good telling everything to output UTF8, but if
all your previous data is stored in another format then things will get
bungled. Try dumping your database and reloading it as UTF8 (see
mysqldump/mysql --char-set flag).

Richard

On 2 January 2012 21:05, Franz Holzinger <franz at ttproducts.de> wrote:

> 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<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&auml;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
>
>
>
>
>
>
>
> ______________________________**_________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-dev<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev>



More information about the TYPO3-dev mailing list