Use the encode method of the path