force encoding to work on request made for api by web browser
I am maintaning an API that have some requests made by a front-end app. When I call it from postman, all work well, including its encoding. The response is:
{ "message": "Esse nome de usuário está disponível" }
However, when I make it from browser, I receive:
{"message":"Esse nome de usu\u00e1rio est\u00e1 dispon\u00edvel"}
I already made this [https://medium.com/@DarkGhostHunter/laravel-convert-to-json-all-responses-automatically-c4a72b2fd3ac] tutorial, that creates an middleware forcing the content, and on my project I set it like this, unlike the code it sugests:
$request->headers->set('Accept', 'application/json; charset=UTF-8');
$request->headers->set('Charset', 'utf-8');
In postman, I saw that these headers were not setted when making the request.
Also, I already tried to set in my controller response:
return response()->json([
'message' => __('auth.nickname_available'),
], 200, ['Content-Type' => 'application/json;charset=UTF-8', 'Charset' => 'utf-8']);
I followed this [https://stackoverflow.com/questions/50717005/laravel-encode-json-responses-in-utf-8/50717612] tip. But neither worked.
How can I can make this work well?
Please or to participate in this conversation.