Skip to Navigation | Skip to Content



Archive for the ‘ruby’ Category

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>“Â

Posted in ruby, rubyonrails, web development | No Comments » | Add to Delicious | Digg It


Search Posts

You are currently browsing the archives for the Uncategorized category.

Archives

Categories

LinkedIn Profile

  • My Profile


My ideal work culture:
[See my summary] [What's yours?]