Skip to content

Instantly share code, notes, and snippets.

@alrnz
Created December 2, 2021 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alrnz/703f4139fd9fb2b29aae530f330d0e8a to your computer and use it in GitHub Desktop.
Save alrnz/703f4139fd9fb2b29aae530f330d0e8a to your computer and use it in GitHub Desktop.
Replace decomposed saved chars in the db
/*
Ersetzt alle "Decomposed" gespeicherten Umlaute (ü,ö,ä,Ö) in der Datenbank
Ersetzt alle kaputten Ligaturen (ffi) in der Datenbank
https://de.wikipedia.org/wiki/Umlaut#Unicode
*/
UPDATE THE_TABLE
SET THE_FIELD = UNHEX(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
HEX(THE_FIELD)
, 'EFAC83', '666669') /* ffi => EFAC83 => 666669 */
, '6FCC88', 'C3B6') /* ö => 6FCC88 => C3B6 */
, '61CC88', 'C3A4') /* ä => 61CC88 => C3A4 */
, '75CC88', 'C3BC') /* ü => 75CC88 => C3BC */
, '4FCC88', 'C396') /* Ö => 4FCC88 => C396 */
) WHERE HEX(THE_FIELD) LIKE '%CC88%' or HEX(THE_FIELD) LIKE '%EFAC83%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment