Support the ongoing development of Laravel.io →
Configuration Database Eloquent
Last updated 2 years ago.
0

You will indeed need to convert any non-utf8 data into utf8 before passing it to json_encode.

Last updated 2 years ago.
0

So, with all of my database models I'll need to convert with something like this?

$row->$key = mb_detect_encoding($value, mb_detect_order(), true) === 'UTF-8' ? $value : utf8_encode($value);

Doesn't this seem like it goes against the simplicity of Eloquent? It just seems like there must be a better solution.

Last updated 2 years ago.
0

I've come across this bug, so I'll be using a wrapper function for all JSON responses that does this:

Response::json(array('text' => ' test'), 200, null, JSON_UNESCAPED_UNICODE);
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jjwdesign jjwdesign Joined 20 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.