Improve character conversion code for file names.

Thanks to <kissgab> on who sent me a message with the pointer on magento connect!