Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1216

Fatal error: Uncaught mysqli_sql_exception: Incorrect string value: '\xF6'

$
0
0

My hosting provider changed the mysql server default value of the character_set_server and character_set_database system variables from latin1 to utf8mb4.

Since then, the file upload functions failes with the following fatal error:

Fatal error: Uncaught mysqli_sql_exception: Incorrect string value: '\xF6' for column 'city' at row 1 in upload.php:98 Stack trace: #0 upload.php(98): mysqli->query('INSERT INTO ...') #1 {main} thrown in upload.php on line 98

The following points I've checked so far:

enter image description here

Variable character_set_system seems odd.

<?php$db = new mysqli($host, $user, $pass, $dbas);if ($db->connect_errno) {    echo "Failed to connect to MySQL: (" . $dbmysqli->connect_errno . ") " . $db->connect_error;}$db->set_charset('utf8mb4');var_dump( $db->get_charset() );

Result of the var dump is the following:

{  ["charset"]=>  string(7) "utf8mb4"  ["collation"]=>  string(18) "utf8mb4_general_ci"  ["dir"]=>  string(0) ""  ["min_length"]=>  int(1)  ["max_length"]=>  int(4)  ["number"]=>  int(45)  ["state"]=>  int(1)  ["comment"]=>  string(13) "UTF-8 Unicode"}

The collation of the table and of all fields was changed to utf8mb4_general_ci.

enter image description here

I've checked the encoding of the values before the SQL INSERT execution with mb_detect_encoding( $value, "auto" ); and it's UTF-8.

I've no clue what to check or what to do. Can anyone help?


Viewing all articles
Browse latest Browse all 1216

Trending Articles