I had the same problem in Ruby 1.9 and Rails 2.3.2, to make it work, I had to make the following changes to the webrat gem.
As lib/webrat/core/locators/link_locator.rbI had to change:
def replace_nbsp(str)
str.gsub([0xA0].pack('U'), ' ')
end
to
def replace_nbsp(str)
if str.respond_to?(:valid_encoding?)
str.force_encoding('UTF-8').gsub(/\xc2\xa0/u, ' ')
else
str.gsub(/\xc2\xa0/u, ' ')
end
end
, webrat Ticket 260, , . , .