<?php
/**
* fixing utf8 post name
*/

/** Sets up the WordPress Environment. */
require( dirname(__FILE__) . '/wp-load.php' );

$posts_to_fix = $wpdb->get_results("SELECT ID, post_name FROM $wpdb->posts");

foreach ($posts_to_fix as $fix) {
echo "fixing: $fix->ID\n";
$name = sanitize_title($fix->post_name);
$wpdb->query("
UPDATE $wpdb->posts
SET post_name = '$name'
WHERE ID = " . $fix->ID);

}

?>