(I accidentially asked this question first on DBA but found out in the FAQ to ask SQL questions here on SO instead)
I'm trying to "repair" a MySQL database (UTF-8 collation) that was imported from an encoding-broken SQL text file.
I.e. the German umlauts are broken inside the database. What should read e.g. "ü" is displayed as "ü".
Since I'm aware of the REPLACE
function, I first tried the obvious:
SELECT * FROM `mydb`.`mytable` WHERE `mycolumn` LIKE '%ü%';
This gave me the expected results.
Next I tried to replace them:
UPDATE `mydb`.`mytable` SET `mycolumn` = REPLACE(`mycolumn`, 'ü', 'ü');
To my surprise, this resulted in zero rows affected.
So even knowing a lot about encoding, I still cannot figure out how to solve this (or whether it is possible at all).
My question:
How to use the REPLACE
function to replace broken German umlauts?