问题
I am using external DB(charset:latin1_swedish_ci, collation=latin1, MyISAM) with internal DB(utf8mb4_unicode_ci, utf8mb4, InnoDB).
- customer_name : collation = utf8mb4_unicode_ci
- customer_email : collation = utf8mb4_unicode_ci
So everytime I get the below exception warning when getting data from external DB.
How should I modify DB setting in my situation? Thanks.
(3/3) QueryException
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF8peri ...' for column 'customer_name' at row 1 (SQL: insert into customers
(id
, customer_name
, customer_email
) values (10008, Olsen Naen Klist�pe AS, naen@klist.no))
external DB
Internal DB
Test System : Win10(64bit), Mysql(v5.7.19, InnoDB), PHP(v7.1), Laravel(v5.4)
回答1:
If that was supposed to be ø
, then you need do one of two things:
Switch the encoding of text in the client from latin1 to UTF-8.
Tell MySQL that the client is conversing in latin1.
Other charset debugging: Trouble with UTF-8 characters; what I see is not what I stored
来源:https://stackoverflow.com/questions/46640891/db-collation-and-chartset-setting-in-mysql-in-laravel