Quantcast
Viewing all articles
Browse latest Browse all 64

php 8 pdo invalid string data with utf8mb4 and utf8mb4_0900_ai_ci collation [duplicate]

I am trying to insert data into a mysql table (named manufacturers) with the following configuration settings:

mysql:host=localhost;dbname=administration;charset=utf8mb4;collation=utf8mb4_0900_ai_ci;port=3306

I get:

SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xE9 Panh...' for column 'CEO' at row 1

The field value for CEO is shown below

Ren� Panhard, �mile Levassor, and Belgian lawyer Edouard Sarazin

If I remove the accented characters and replace them with an "e", everything works fine.

Everything I've read says its a problem with the collation. However, all the variables appear to be set identically. I've tried SET NAMES, modifying the connect dsn, rebuilding the table, but it just doesn't work. I am using PHP 8 and MySQL 8. All the fixes in the "similar" list are for old outdated versions of PHP and MySql.

At the point of insertion, the following settings are in place.

Outputting schema collation:

administration  utf8mb4 utf8mb4_0900_ai_ci

Outputting session variables

character_set_client    utf8mb4character_set_connection    utf8mb4character_set_results   utf8mb4collation_connection    utf8mb4_0900_ai_ci

session collation variables:

collation_connection    utf8mb4_0900_ai_cicollation_database  utf8mb4_0900_ai_cicollation_server    utf8mb4_0900_ai_ci

session character_set:

character_set_client    utf8mb4character_set_connection    utf8mb4character_set_database  utf8mb4character_set_filesystem    binarycharacter_set_results   utf8mb4character_set_server    utf8mb4character_set_system    utf8mb3character_sets_dir  C:\Program Files\MySQL\MySQL Server 8.0\share\charsets\

manufacturer table info

Table info:

manufacturer    utf8mb4_0900_ai_ci

outputting table column info

Table info:

manufacturer    address1    utf8mb4_0900_ai_cimanufacturer    address2    utf8mb4_0900_ai_cimanufacturer    CEO utf8mb4_0900_ai_cimanufacturer    city    utf8mb4_0900_ai_cimanufacturer    country utf8mb4_0900_ai_cimanufacturer    dateadded   manufacturer    emailaddress    utf8mb4_0900_ai_cimanufacturer    endyear utf8mb4_0900_ai_cimanufacturer    lastupdated manufacturer    Lastupdatedby   utf8mb4_0900_ai_cimanufacturer    mfrid   manufacturer    modelyr utf8mb4_0900_ai_cimanufacturer    name    utf8mb4_0900_ai_cimanufacturer    phone   utf8mb4_0900_ai_cimanufacturer    postalcd    utf8mb4_0900_ai_cimanufacturer    stateorprovince utf8mb4_0900_ai_cimanufacturer    wwwaddress  utf8mb4_0900_ai_ci

Viewing all articles
Browse latest Browse all 64

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>