I have never had any problems with umlauts or emojis with Laravel. And also never changed the database settings.
Is utf8mb4_unicode_ci available in the database and how is the data passed?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How can I specifically target the umlaut letters? Currently, the database ignores the umlaut completely: ö is treated as o, ...
If I type "böse", it returns "böse" and "bose". That is not what I want, only "böse" should be returned.
I have tried changing the database config, specifically the 'charset' and 'collation' attributes. I have set them to :
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => false,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
but that yielded no success. Also tried appending this statement to my query:
$query->query("CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL")
but nothing. Umlauts are still ignored. Any help pls
I made this modification in "config/database.php" file:
'charset' => 'utf8',
'collation' => 'utf8_german2_ci',
and also made this alteration in the DB directly, manually, or via query:
DB::query("ALTER TABLE `" . env("DB_DATABASE") . "`.`" . $tableName. "` convert to character SET utf8 COLLATE utf8_german2_ci");
This did the trick.
Please or to participate in this conversation.