html_escape(s) public

Takes a string s with some HTML in it, and escapes ‘&’, ‘“’, ‘<’ and ‘>’, by replacing them with the appropriate entities.

This method is also aliased to h, for convenience.

Examples:

require 'rss/utils'

RSS::Utils.html_escape("Dungeons & Dragons")
# => "Dungeons & Dragons"
RSS::Utils.h(">_>")
# => ">_>"
Show source
Register or log in to add new notes.