If I\'m in an RHTML view in Rails, it is easy to URL-escape something:
\">Foo
Use either CGI::escape or ERB::Util.url_encode but not URI.encode.
CGI::escape
ERB::Util.url_encode
URI.encode
URI.escape has been deprecated circa Ruby 1.9.2: What's the difference between URI.escape and CGI.escape?
URI.escape