If you create a URL with query parameters in a string URL such as
https: // xxxx, the query parameters need to be converted to a special form.
You need to execute
% 2B and
require 'cgi' CGI.escape('+ &') # => "%2B+%26"
Try constructing the URL using
There are many things that can be improved, such as using hashes, but here is a simple pattern.
value is escaped, thinking that it is unlikely to use special characters for
If you also want to escape
You can refer to https://github.com/rails/rails/blob/3-0-stable/activesupport/lib/active_support/core_ext/object/to_query.rb.