Hello

I am started my adventures with Ruby I want to write simple parser:

if RUBY_VERSION =~ /1.9/
    Encoding.default_external = Encoding::UTF_8
    Encoding.default_internal = Encoding::UTF_8
end

url = URI.parse('example url')

response = Net::HTTP.start(url.host, url.port) do |http|
  http.get(url.path)
end

main_page = response.body
links = main_page.slice!(/<table class="regions">.+<\/table>/)


I am getting error: parser.rb:17:in `slice!': invalid byte sequence in
UTF-8 (ArgumentError)

Could somebody explain me how to resolve this problem?
All solutions that I found doesn't work for me.

Regards

-- 
Posted via http://www.ruby-forum.com/.