J
James Coglan
[Note: parts of this message were removed to make it a legal post.]
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:roxy
def rewrite_env(env)
env['HTTP_HOST'] = 'l-tike.com'
env
end
end
session = Capybara::Session.newrack_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?
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:roxy
def rewrite_env(env)
env['HTTP_HOST'] = 'l-tike.com'
env
end
end
session = Capybara::Session.newrack_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?