I am currently having a problem in decoding PHP characters, I am calling an API using a file_get_contents () and then calling with a variable:
$jsondata = file_get_contents(URL DEL API);
$data = json_decode($jsondata, true, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
But when doing the decode all the characters that have tilde have a strange character ... already try making encode and later a decode with utf8 (this had already happened to me in other php without the file_get_contents ()):
$data = json_encode($jsondata, true, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
$data2 = utf8_decode($data);
And I get this error:
Warning: Illegal string offset 'actions' in /var/www/html/psu/public/json/zjson.php on line 30
Warning: Invalid argument supplied for foreach() in /var/www/html/psu/public/json/zjson.php on line 30
Is there any way to convert this data to utf-8 and save it in that format in my database?