Posted on 04-16-2014 under Allgemein, Internet

Germanic umlaut on keyboardHeute habe ich mich mal um ein altes Problem dieses Blogs hier gekümmert. Und zwar waren bei allen älteren Beiträgen die Umlaute zerschossen. Das ist mir schon früher aufgefallen, aber ich hatte nie den Antrieb dazu mich schlau zu machen, wie man das beheben kann. Das Problem ist im Internet sehr bekannt und entsteht in den meisten Fällen bei einem Serverumzug. Bei mir kam das aber irgendwann bei einem älteren WordPress Update mal zustande.

Zuerst habe ich MySQL-Dumper auf meinem Webspace hochgeladen und installiert. Damit habe ich erstmal alle meine Datenbanken gesichert. Danach bin ich ans Eingemachte gegangen und habe über das Interface von MySQL-Dumper folgende SQL-Befehle ausgeführt:

Umlaute im Text korrigieren:
UPDATE wp_posts SET post_content = replace(post_content, 'ü', 'ü');
UPDATE wp_posts SET post_content = replace(post_content, 'ö', 'ö');
UPDATE wp_posts SET post_content = replace(post_content, 'ä', 'ä');
UPDATE wp_posts SET post_content = replace(post_content, 'ß', 'ß');

Umlaute im Post-Titel korrigieren:
UPDATE wp_posts SET post_title = replace(post_title, 'ü', 'ü');
UPDATE wp_posts SET post_title = replace(post_title, 'ö', 'ö');
UPDATE wp_posts SET post_title = replace(post_title, 'ä', 'ä');
UPDATE wp_posts SET post_title = replace(post_title, 'ß', 'ß');

Umlaute in Kommentaren korrigieren
UPDATE wp_comments SET comment_content = replace(comment_content, 'ü', 'ü');
UPDATE wp_comments SET comment_content = replace(comment_content, 'ö', 'ö');
UPDATE wp_comments SET comment_content = replace(comment_content, 'ä', 'ä');
UPDATE wp_comments SET comment_content = replace(comment_content, 'ß', 'ß');

Umlaute im Titel der Kommentare korrigieren
UPDATE wp_comments SET comment_author = replace(comment_author, 'ü', 'ü');
UPDATE wp_comments SET comment_author = replace(comment_author, 'ö', 'ö');
UPDATE wp_comments SET comment_author = replace(comment_author, 'ä', 'ä');
UPDATE wp_comments SET comment_author = replace(comment_author, 'ß', 'ß');

Dann hab ich das alles nochmal für die Großbuchstaben mit folgenden Änderungen der obigen Code Snippets gemacht: (Ãœ -> Ü), (Ö -> Ö) und (Ä -> Ä)

Bindestriche korrigieren:
UPDATE wp_posts SET post_content = replace(post_content, '–', '–');
UPDATE wp_posts SET post_title = replace(post_title, '–', '–');

Und tatsächlich, es hat geklappt! Alle zerschossenen Umlaute wurden wieder richtig dargestellt. Gut, es war zwar alles viel Arbeit. Aber es hat sich gelohnt. Endlich ist dieses alte Problem behoben. *freu*

Bildquelle: Wikipedia / Das Original wurde von LSDSL erstellt (modifiziert von mir)