Handle unicode paths

This should fix #1381 . Many thanks to @LinneaWilling for finding the issue!
It is a little strange that this is on one line here but on two lines in the next file. Not sure if you want to be consistent.