JSON encoding unsuccessful when data consists umlauts (e.g: ä, ö, ü, õ) and when I replace these letters or remove manually from my MySQL table, everything works perfectly.
It does not give me any errors but JSON is just not appearing.
I really need a fix for my problem because every letter counts. Especially when it is about names.
<?php
Header('Content-Type: application/json; charset=UTF-8');
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
$app = new \Slim\App;
$app->get('/api/standings', function(Request $request, Response $response){
    $sql = "SELECT * FROM standings";
    try {
        $db = new db();
        $db = $db->connect();
        $stmt = $db->query($sql);
        $standings = $stmt->fetchAll(PDO::FETCH_OBJ);
        $db = null;
        $json = json_encode($standings, JSON_UNESCAPED_UNICODE);
        echo $json;
    } catch(PDOException $e) {
        echo '{"error": {"text": '.$e->getMessage().'}';
    }
});