Backport CGI::escapeHTML function from the Ruby standard library

The CGI::escapeHTML function backported from the Ruby standard library
as of commit fd2fc885b43283aa3d76820b2dfa9de19a77012f

Implementation of the cgi module can change among Ruby versions
so stabilizing on a single one here to avoid surprises.

https://github.com/ruby/ruby/blob/trunk/lib/cgi/util.rb