Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

French characters in MySQL database

Tags:

sql

mysql

I have a huge database of book authors in which names of French authors have not been stored correctly and the French characters have been replaced by some strange characters!

Can I solve the problem by a SQL query? if yes, I do appreciate if you give me a clue.

Thanks,

like image 962
Ashkan Avatar asked Nov 04 '22 08:11

Ashkan


1 Answers

  1. Export your table data with a mysqldump
  2. Change the character encoding of the dump file create table statement to utf8
  3. drop the table or change the name to something like tablename_old (I recommend keeping the old table until after the experiment ;))
  4. Import the modified dump file

Since french characters are all in UTF8 and you probably don't have a multi-byte encoding character set on your table, this should fix the issue.

You might be able to just run an alter table to change the encoding, but in my experience that can be a roll of the dice.

like image 145
Ray Avatar answered Nov 09 '22 10:11

Ray