I have a json file like this
{"downloads":[
{
"url":"arquivo1.pdf",
"descricao":"árquivo 1"
},
{
"url":"arquivo2.pdf",
"descricao":"arquivo 2"
}
]}
And I save it using UTF-8 encode via Notepad++.
Then I get the file content:
function getContent($name)
{
$content = file_get_contents("configs/" . $name . ".json");
$encoded = utf8_encode($content);
return json_decode($encoded);
}
and json_decode returns null.
If I save the json file as ANSI then it works. But I'd like to save it as UTF-8.