Use the htmlentities Show archive.org snapshot gem.
Encoding works like this:
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>"
Decoding works like this:
require 'htmlentities'
coder = HTMLEntities.new
string = "élan"
coder.decode(string) # => "élan"
Posted by Henning Koch to makandra dev (2010-12-07 09:36)