Project

General

Profile

Actions

Feature #80398

closed

Make default charset and collation for new tables configurable

Added by Marco von Arx over 7 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
Start date:
2017-03-22
Due date:
% Done:

100%

Estimated time:
PHP Version:
7.0
Tags:
charset utf8mb4
Complexity:
Sprint Focus:

Description

to be able to store 4 byte unicode characters we need to set database to utf8mb4. since typo3 8 there is a configuration parameter for that but it seems that it is not taken into account.

LocalConfiguration.php

    'DB' => [
        'Connections' => [
            'Default' => [
                'charset' => 'utf8mb4',
                'dbname' => '--dbname--',
                'driver' => 'mysqli',
                'host' => '127.0.0.1',
                'password' => '--mypassword--',
                'port' => 3306,
                'user' => '--myuser--',
            ],
        ],
    ],

create table statements do have a fallback but do not read from configuration

    private function buildTableOptions(array $options)
    {               
        if (isset($options['table_options'])) {
            return $options['table_options'];
        }

        $tableOptions = array();

        // Charset
        if ( ! isset($options['charset'])) {
            $options['charset'] = 'utf8';
        }
        ....
    }

DatabaseConnection class also does not read charset configuration either it takes utf8 as a default.

        $connection = \Doctrine\DBAL\DriverManager::getConnection([
            'driver' => 'mysqli',
            'wrapperClass' => Connection::class,
            'host' => $host,
            'port' => (int)$this->databasePort,
            'unix_socket' => $this->databaseSocket,
            'user' => $this->databaseUsername,
            'password' => $this->databaseUserPassword,
            'charset' => $this->connectionCharset,
        ]);

it was stated that it would be fixed in CMS 8
https://forge.typo3.org/issues/71454

is this on roadmap? before LTS?


Files

typo3-utf8mb4-0.png (104 KB) typo3-utf8mb4-0.png With utf8(mb3) saving fails Lienhart Woitok, 2018-09-12 13:11
typo3-utf8mb4-1.png (233 KB) typo3-utf8mb4-1.png A few emojis (Chrome on ubuntu) Lienhart Woitok, 2018-09-12 13:11
typo3-utf8mb4-2.png (454 KB) typo3-utf8mb4-2.png Same content, Chrome on Android Lienhart Woitok, 2018-09-12 13:11

Related issues 8 (0 open8 closed)

Related to TYPO3 Core - Feature #80659: Set Charset to utf8mb4Closed2017-04-03

Actions
Related to TYPO3 Core - Bug #82551: Upgrade Wizard DeadlockClosed2017-09-25

Actions
Related to TYPO3 Core - Bug #82080: Indexes too large for some tables with utf8mb4Closed2017-08-11

Actions
Related to TYPO3 Core - Feature #71454: Allow setting Connection CharsetClosed2015-11-10

Actions
Related to TYPO3 Core - Bug #86793: Renamed columns are not correctly detected by database schema diffClosed2018-10-30

Actions
Related to TYPO3 Core - Bug #97961: Transform `tableoptions` early to valid `doctrine/dbal` optionClosed2022-07-16

Actions
Related to TYPO3 Core - Task #105289: Mitigate deprecated Doctrine DBAL connection optionsClosedStefan Bürk2024-10-12

Actions
Related to TYPO3 Core - Task #105297: Deprecate `tableoptions` and `collate` connection configurationClosedStefan Bürk2024-10-13

Actions
Actions

Also available in: Atom PDF