1

I'm working with German Umlauten like aöü.

The carset is set to utf8_general on php and database. Insert aswell as select is working fine, only if the data is inserted by using

$stmt->send_long_data(1,$entry->text);

These german characters end up as ü in the database. If they are inserted without send_long_data they are getting stored correctly. I've also tried it out with other columns aswell.

It's allways the same: Normal Insert --> Umlaute stored as äöü. Using send_long_data --> stored as ü and so on.

I've red through UTF-8 all the way through, but I couldn't really find an answer.

$ret ="";
$null= NULL;
$entry->a_date=convert_date($entry->a_date);
$conn=get_sql_connection();
$stmt = $conn->prepare("SELECT create_entry (?,?,?,?,?)");;
$stmt->bind_param("sbisi",$entry->head,$null,$entry->area,$entry->a_date,$entry->showdate);
$stmt->send_long_data(1,$entry->text);
$stmt->execute();
$stmt->bind_result($col);
$stmt->fetch();
$ret = $col;
finish($stmt);
return $ret;
Community
  • 1
  • 1
Johannes M
  • 65
  • 1
  • 9

1 Answers1

0

Mojibake

  • The bytes you have in the client are correctly encoded in utf8 (good).
  • You connected with SET NAMES latin1 (or set_charset('latin1') or ...), probably by default. (It should have been utf8.) If you are using PDO, set the charset attribute of the PDO dsn or via SET NAMES utf8mb4.
  • The column in the tables may or may not have been CHARACTER SET utf8, but it should have been that.

Please provide SELECT col, HEX(col) FROM tbl WHERE ... -- ü should have hex of C3BC (utf8 encoding), not FC (latin1 encoding), not C383C2BC (double-encoding).

Rick James
  • 135,179
  • 13
  • 127
  • 222