HPricot and utf-8

May 27th, 2008

I tried to use Hpricot to parse a page with special characters in a utf-8 encoding. The docs tell you to do this:

require 'rubygems' require 'open-uri' require 'hpricot' doc = Hpricot(open("http://url/"))

However, this won't give you the output you want. The open method on Open-URI leaves the output in the default character set of the page. If you want to convert it to utf-8, you need to use the iconv library:

require 'rubygems'
require 'iconv'
require 'open-uri'
require 'hpricot'

f = open("http://url")
f.rewind
doc = Hpricot(Iconv.conv('utf-8', f.charset, f.readlines.join("\n"))
Tragedy Strikes
It was a true tragedy I didn't win this.

Unobtrusive Javascript

May 27th, 2008

In January, I gave a presentation at the Orlando Ruby Users Group about unobtrusive javascript. I figured that I'd reproduce it here for anyone who wanted to watch it. Some topics covered in the video include semantic markup, benefits of coding unobtrusively, examples, and guidelines. Special thanks to Gregg Pollack for editing the video, and an extra special thanks to Jason Hawkins from Make Film Work for filming.

Unobtrusive Javascript Presentation from Jason Seifer on Vimeo.