Handle UndefinedConversionError when converting to utf-8

From: http://ruby-doc.org/core-2.0/String.html#method-i-encode

Ducktypes for having encode rather than relying on RUBY_VERSION
Remove unused variable
Fix tests for basic encoding
needs _spec.rb to be run by `rake spec`
Merge remote-tracking branch 'opennewzealand_github/feature/handle-undefined-conversion' into rails-3-develop