oriceon
1929
13
General

Laravel 5 - problem with UTF-8 in a json response

Posted 3 years ago by oriceon

Hello, I`m playing with some utf-8 strings in a ajaxcontroller and i get an error: The Response content must be a string or object implementing __toString(), "boolean" given

$address = ['şâţ' => 1];

$response = response()->json($address);
$response->header('Content-Type', 'application/json');
$response->header('charset', 'utf-8');

return $response;

Anyone know a fix for that? Thanks!

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.