I have a table in my database where some rows are binary strings, and other are wrongly encoded :
id 1 = b"éhhh
id 2 = éhhh
If I try to convert the column
UPDATE my_table SET my_column =
CONVERT(BINARY CONVERT(my_column USING latin1) USING utf8)
WHERE LENGTH(my_column) != CHAR_LENGTH(my_column);
But when I do that all my binary values disapear :
id 1 = (empty)
id 2 = éhhh
Is there a way to encode all the table without losing any value ?
Here is the create statement of my table :
CREATE TABLE `my_table` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`area_id` int(11) NOT NULL DEFAULT '0',
`my_column` varchar(25) NOT NULL DEFAULT '',
`description` varchar(60) DEFAULT NULL,
`capacity` int(11) NOT NULL DEFAULT '0',
`admin_email` mediumtext,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
Here are 2 exemple of HEX
église St Alban de R. = C383C2A9676C69736520537420416C62616E20646520522E
église St Jean-Baptiste = C3A9676C697365205374204A65616E2D4261707469737465