How do I raw URL encode/decode in JavaScript and Ruby to get the same values in both?
Use
URI.escape(foo, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
in ruby, and
encodeURIComponent(foo);
in javascript
Both these will behave equally and encode space as %20.