Encode paths before use them.