jeudi 24 décembre 2015

Laravel eloquent not receiving accented characters from sqlite database

I am using Laravel Eloquent to retrieve records from database. When I access string property of certain Eloquent model, it works perfectly as long as the string does not contain any accented character. Otherwise, I get some b-prefixed string literal full of strange characters. Such string passed to blade template does not render at all.

// Laravel dump
dump(Project::find(1)->title); // displays b"¬ernob¡lì svØt"
dump('Černobílý svět');        // displays "Černobílý svět" correctly

// Artisan tinker
>>> App\Project::find(10)->title
=> b"┬Černob┬íl├Č sv├śt"

However, when I access that record using sqlite command line, string looks fine. I guess this is a consequence of badly configured encoding but I have no idea how to fix it.

sqlite> select id, title from projects where id = 10
10 | Černobílý svět

Thanks in advance!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire