json_encode() escapes these characters by default. You may specify the option JSON_UNESCAPED_UNICODE to disable that. See https://secure.php.net/manual/en/function.json-encode.php
Feb 18, 2018
7
Level 1
Getting a utf8 decoded string when retrieving session data
I'm trying to log some data in a middleware, and I'm storing the json that session('errors') returns in database. But all unicode characters are escaped.
I've made it work with a workaround but it feels very hacky.
Is there a recommended way of getting utf8 strings out of session?
Level 42
No, I'm suggesting to use the option JSON_UNESCAPED_UNICODE:
logger(session('errors')->toJson(JSON_UNESCAPED_UNICODE))
instead of
logger(session('errors'))
1 like
Please or to participate in this conversation.