Laravel Umlaute ORM - Problems With Saving

- 1 answer

I receive some "Umlaute" - like "ä,ü,ö) from an webservice, and i have problems with utf-8 here. When ill store them into my database, it shown like:


Ok, so checked about utf-8 encoding, but when ill try to echo the value before saving it, its shown correct with all the Umlaute in utf-8.

My database is utf-8 too (another tables from different services store utf-8 without any problems). The only thing whats different here is, that i am storing it in an transaction.

echo $laststop; // Fine with all the Umlaute

$Route = new BusRoute();
$Route->last_stop = $laststop; // if i set this to something like that: "Tüüt" as String, its correct in DB too

// wrong in database

// database.php
'dev_db' => [
        'driver'   => 'sqlsrv',
        'charset'  => 'utf8',
        'prefix'   => '',

// model.php

class BusRoute extends Model
    protected $connection = 'db_dev';

     * The database table used by the model.
     * @var string
     protected $table = 'bus_routes';


Edit: Checked my Model "BusRoute.php" - saved with UTF-8 Encoding.

Its strange - because i read multiple webservices - and only got here that problem. Any ideas?



The webservice delivers you data with certain characters encoded to their corresponding html entites. Use html_entity_decode() to convert them back to single characters before storing the data in your database.

$decoded_string = html_entity_decode('..rsität');

This will convert ä back to ä.