Properly encode filenames using RFC6266.

see #473
fixes #481