Correcting French Characters in MySQL

Posted on

Question :

I Have a huge MySQL table with a long list of charities. Some of the charities have French characters in them which appear incorrectly.

For example I’m getting uppercase ‘É’ instead of ‘é’ in the middle of some names.

I’m wondering how I do a simple find change to correct this. I’d tried a few scripts but they don’t execute due to errors.

In this table find ‘É’ and replace with ‘é’.

Many Thanks.

Answer :

    SET col = REPLACE(col, 'É', 'é') COLLATE utf8_bin;

I don’t know if the COLLATE clause is needed at all.
If col is not CHARACTER SET utf8, then use the appropriate “_bin” collation.
Test before applying:

SELECT col, REPLACE(col, 'É', 'é')
    FROM tbl
    WHERE col LIKE '%É%'
    LIMIT 22;

Leave a Reply

Your email address will not be published. Required fields are marked *