mardi 29 septembre 2015

encode_www_form converting space to + instead of %20

I am trying to create http parameters from a hash i have using Ruby on Rails, i have tried using URI.encode_www_form(params) , but this is not generating the parameters correctly.

Below is the hash i have

    params['Name'.to_sym] = 'Nia Kun'
    params['AddressLine1'.to_sym] = 'Address One'
    params['City'.to_sym] = 'City Name'

This method converts space to +, what i want is it to convert space with %20

i am getting "Name=Nia+Kun&AddressLine1=Address+One&City=City+Name" but i need ths spaces to be converted to %20

any help will be appricaited, Thanks.

Aucun commentaire:

Enregistrer un commentaire