how to pass '?' character in url (rails)

i want to pass a query to url like
http:/localhost:3000/saldo/;1010917745800000015?1



in my routes i have:



get 'saldo/:nomor' => 'kartus#show_saldo' , as: :show_saldo


and controller:



def show_saldo
@kartu = Kartu.find_by_nomor(params[:nomor])
end


but instead i get this params



Parameters {"1"=> nil,"nomor"=>";1010917745800000015"}


how can i get my param as {"nomor"=>";1010917745800000015?1"}



Answers

<%= link_to 'xyz' show_saldo_path(:nomor => 'nomor', :def => 'def'......) %>


In get everything you passed other than url parameter will become your query parameter. def will become your url parameter. More information here.



Answers

? is a special character in urls. If you want to include it in the value of a parameter then you should Uri Encode, eg with CGI.escape(), the parameter before submitting it: this will convert "?" to "%3F", and will similarly convert any other special characters (spaces, brackets etc). So, the parameter that is actually submitted will become "%3B1010917745800000015%3F1".



At the server side, rails will call CGI.unescape on the params, so it should show up in your controller as ";1010917745800000015?1" again.



This should happen automatically with form inputs - ie, if someone writes ;1010917745800000015?1 into a text field then it should actually be sent through as "%3B1010917745800000015%3F1"



If you want people to diagnose why this isn't happening then you should include the html (of the form or link which is submitting this value) to your question.