Decode and encode path components properly.