missing encoding param mangles filename (fixes issue #1803)