Fix for unicode filenames

Solution taken from <http://stackoverflow.com/a/20939982>.