Nothing worse than user contributed image files with strange (non-english) characters in the file name right? Here's what you can do about it in WordPress.

If you are working with WordPress Sites in non-english languages, like for instance Swedish, like I am, sometimes there can be a world if pain when moving sites between hosts if the file names include non-standard charachters such as åÅ, äÄ, öÖ. The images appear as broken, becuase something with the file name encoding happens along the way. Here is a function to put in your themes functions.php that will help sanitize file names of uploaded files.

add_filter('sanitize_file_name', 'sa_sanitize_chars', 10); 

function sa_sanitize_chars ($filename) { 
  return remove_accents( $filename );