0

All foreign characters such as umlauts (ü) get deleted when trying to put them into mysql.

In debugging this problem I've went over the following:

My database is UTF-8

The table in question is InnoDB utf8_general_ci. Row is longtext utf8_general_ci

I've added mysqli_set_charset($mysqli, "utf8"); right after $mysqli = new mysqli($hostname, $username, $password, $database);

It goes in using the following php:

    $stmt = $mysqli->prepare("
    UPDATE post
    SET post = ?,
    title = ?
    WHERE id = ?
    ");
    $stmt->bind_param("ssi", $clean_html, $titlePost, $id);

String before going being updated in db is

<p>SOME NEW TEXT</p><p> </p><p>üü</p>

But still nothing. The umlauts disappear. In the DB it shows up as

<p>SOME NEW TEXT</p><p></p><p></p>

What other debugging steps should I take? Thank you

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Noodle Head
  • 431
  • 3
  • 10
  • 23

1 Answers1

0

Try utf8_encode() and utf8_decode() maybe it can help. before setting the value to database try $value = utf8_encode($value);

Avneesh
  • 149
  • 1
  • 1
  • 7