您好,有没有与JavaScript encodeURIComponent
方法等效的ruby方法?我使用的是URI.unescape(str)
,但它将"£"
(在encodeURIComponent
之后变为"%C2%A3"
)识别为"?"
符号。有什么解决方案吗?谢谢
发布于 2010-05-18 22:58:31
URI.escape(foo, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
点击此处:How do I raw URL encode/decode in JavaScript and Ruby to get the same values in both?
发布于 2010-05-19 00:17:30
发布于 2013-01-31 18:31:54
我认为最简单的方法是URI.encode_www_form_component
。
https://stackoverflow.com/questions/2858345
复制相似问题