我正在尝试在 rails 中为图像附件编码一个 url,但使用 CGI::escape 或 URI.escape 似乎可以编码所有内容。我只需要编码的逗号和空格,没有别的。我将如何在 Rails 中做到这一点?我做了 gsub,但只能替换逗号或空格,不能同时替换两者。有没有办法做到这两点?
http://"URL"?operation=getfieldclip&outlinePoints=600%2C600%2C400%2CTest Area%2C44.982643%2C-94.696723%2C44.982343%2C-94.696723%2C44.982293%2C-94.697170%2C44.982293%2C-94.697555%2C44.982313%2C-94.697740%2C44.982333%2C-94.697987%2C44.982363%2C-94.698110%2C44.982403%2C-94.698233%2C44.982453%2C-94.698341%2C44.982493%2C-94.698511%2C44.982553
我可以更改逗号,但不确定如何同时更改空格。