For Ruby: htmlentities, server.htmlencode, escape, uriencode | May 7th, 2008
Ever wanted to HTML encode strings in Ruby? I did. I found this. It works great!
http://htmlentities.rubyforge.org/
To install just go:
gem install -r htmlentities
Then to use:
require ‘htmlentities’
coder = HTMLEntities.new
string = “<ã ©lan>”
coder.encode(string)              # => “<élan>”
coder.encode(string, :named)      # => “<élan>”
coder.encode(string, :decimal)Â Â Â Â # => “<ã ©lan>”
coder.encode(string, :hexadecimal) # => “<ã ©lan>“Â