Solving problem with EOFError in rails requests, by enconding the URL to the correct format