--001485e7c8900be5e1048fa8d622
Content-Type: text/plain; charset=ISO-8859-1
Hi all,
Quick encoding question: say I'm trying to grab data from a Japanese page
using Capybara and Rack::Test, and I get badly encoded text in the response.
e.g. running this script:
require 'rubygems'
require 'capybara'
require 'rack/test'
require 'rack/proxy'
Capybara.default_selector css
class Japan < Rack::Proxy
def rewrite_env(env)
env['HTTP_HOST'] l-tike.com'
env
end
end
session apybara::Session.new(:rack_test, Japan.new)
session.visit '/pickup/concert_more.html'
puts session.body
You'll see weird characters in the output, and I can't find nodes that
should be there with css/xpath. How do I set the encoding so that Nokogiri
parses the page properly?
--
James Coglan
http://jcoglan.com
+44 (0) 7771512510
--001485e7c8900be5e1048fa8d622--