Here’s a code script to convert string data to UTF 8 in your database:

header('Content-Type: text/plain; charset=utf-8');
$databasesToConvert = [ 'database1' */ ];
$typesToConvert = [ 'char', 'varchar', 'tinytext', 'mediumtext', 'text', 'longtext'];
CONVERT(CAST(CONVERT(`{$column}` USING english) AS binary) USING utf8)";
$query = "UPDATE `{$table}` SET " . join( ', ', $converts );
echo "\n", $query, "\n";
echo "\n";

 

BY Best Interview Question ON 25 Nov 2020