I am about to do a similar curl call like this:
curl https://api.mapbox.com/geocoding/v5/mapbox.places/1600+pennsylvania+ave+nw.json
When I enter my own address, it looks like this: 1600 pennsylvania ave nw
. I tried to convert the white spaces to the +
characters with using the URI.encode
method:
address = URI.encode(full_address)
But the result is 1600%20pennsylvania%20ave%20nw
, which, after all, seems to be a correct output, however it doesn't solve my problem.
As a possible solution is to manually convert and replace every character, but is there a better solution?