Ruby encoding problem
Posted
by Fossmo
on Stack Overflow
See other posts from Stack Overflow
or by Fossmo
Published on 2010-05-17T06:17:14Z
Indexed on
2010/05/17
6:20 UTC
Read the original article
Hit count: 363
I'm just starting to learn Ruby and have a problem with encoding;
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
agent.get('myurl.....')
agent.page.search('#reciperesult a').each do |item|
c = Mechanize.new
c.get(item.attributes['href'])
puts c.page.search('#ingredients li').text
end
The output text are shown like this h+©nsekj+©tt when it should have been shown like this hønsekjøtt. I'm using Ruby 1.8.7. Can anybody point me in the right direction?
© Stack Overflow or respective owner