Transliteration- Is it possible to transliterate filenames (and update the DB) after files have been uploaded?
As far as I am able to tell, the script works OK with Unicode.

But the script doesn't sanitize the file names, and that is what invalidates the query.

It could be a a lot worse. If somebody uploads an image named image'); DROP TABLE *;--.jpg, and you use that script, they would erase your site (as shown in the XKCD cartoon below):



Source: xkdc - Exploits of a mom

I would strongly advice postponing the use of that script until somebody who understands database security has cleaned it up.

Suggestion: hand edit the file names with quotes in them by removing the quotes, and edit the corresponding names in table file_managed.

I am also puzzled that the Drupal file upload module does not sanitize file names by not permitting quotes in file names.