I have two character set bugs that are preventing me from seeding my database with an old database's contents.
1. Error Code 1366: Incorrect string value "\xDB"
I've tried changing the CHARACTER SET
of my TABLE
to utf8mb4
.
I've looked into what \xDB would be as a character type, and stumbled upon this. This lead me to believe it's a Javascript escape format. However, I can't seem to find a MySQL CHARACTER SET
that supports this.
Even if I do find a CHARACTER SET
that supports Javascript escape format, wouldn't it be best to convert everything to the more standard and all encompassing utf8mb4
? How would this be done?
2. Error Code 1300: Invalid utf8mb4 character string
This is the offending character: ®
Again, I've tried similar things as mentioned above, with little success.
EDIT:
I set the CHARACTER SET
in a new database as follows:
CREATE TABLE `products` (
`product_id` INT NOT NULL AUTO_INCREMENT UNIQUE,
`product_line` VARCHAR(255) NOT NULL,
`product_num` VARCHAR(255) NOT NULL,
`description` LONGTEXT NOT NULL,
PRIMARY KEY (`product_id`)
) CHARACTER SET utf8mb4 ;
EDIT 2:
I didn't know this made a difference, but the problem was arising while doing a LOAD DATA INFILE
as follows:
USE `inventory`;
LOAD DATA INFILE
'all_products.csv'
INTO TABLE `products`
FIELDS
TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES
TERMINATED BY ',\r\n'
IGNORE 1 ROWS
(`product_line`,`product_num`,`description`);