Correctly encode paths.