0

i get from database a json data.

data contain a romanian simbols like a ĂÎȘȚÂ

and i use code `

$sql = "SELECT data FROM form_submission";
$result = $conn->query($sql);

// Check if there is any data
if ($result->num_rows > 0) {
  // Set the character encoding to UTF-8 to display special characters
  header('Content-Type: text/html; charset=utf-8');

  // Display the data in a table
  echo "<table>";
  echo "<tr><th>Text 1</th><th>Text 2</th><th>Select List 1</th><th>Text 3</th><th>Text 4</th><th>Date 1</th><th>Email 1</th><th>Matrix 1 0</th><th>Matrix 1 1</th><th>Matrix 2 0</th><th>Matrix 2 1</th></tr>";

  while($row = $result->fetch_assoc()) {
    // Decode the JSON data into an associative array
    $data = json_decode($row["data"], true);

    // Display the data in the table
    echo "<tr>";
    echo "<td>" . $data["text_1"] . "</td>";
    echo "<td>" . $data["text_2"] . "</td>";
    echo "<td>" . implode(", ", $data["selectlist_1"]) . "</td>";
    echo "<td>" . $data["text_3"] . "</td>";
    echo "<td>" . $data["text_4"] . "</td>";
    echo "<td>" . $data["date_1"] . "</td>";
    echo "<td>" . $data["email_1"] . "</td>";
    echo "<td>" . $data["matrix_1_0"] . "</td>";
    echo "<td>" . $data["matrix_1_1"] . "</td>";
    echo "<td>" . $data["matrix_2_0"] . "</td>";
    echo "<td>" . $data["matrix_2_1"] . "</td>";
    echo "</tr>";
  }

  echo "</table>";
}

example a Json {"text_1":"ăîțâș","text_2":"ăîșțâț","selectlist_1":["Cabinetul directorului general"],"text_3":"dfasd","text_4":"asdfasdf","date_1":"2023-02-24","email_1":"asdfads@afdsf.ff"}

and all romain simbols display at ?

0 Answers0