Encode the filenames correctly