RSS, Unicode, and KCODE

I have the following test code for a possible RoR RSS web app:

require ‘rss’
require ‘open-uri’

$KCODE = “u”

URL = ‘http://macdailynews.com/index.php/weblog/rss_2.0

open(URL) do |h|
resp = h.read
result = RSS::Parser.parse(resp, false)
puts “Channel: #{result.channel.title}”
result.items.each_with_index do |item, i|
i += 1
puts “#{i} #{item.title}”
end
end

The problem is I still get weird characters (Unicode) in there. How do
I get rid of this?

Also, adding in this:
result.output_encoding = “UTF-8”
doesn’t work either.

Hmm is your console out Unicode? Try writing to a file.

Vish

Vishnu G. wrote:

Hmm is your console out Unicode? Try writing to a file.

Yes, that was the issue. At work I had tried this on a Windows box with
a DOS prompt. At home I tried it on a Mac OS X and it worked fine.
Just another reason why I’m on a Mac now :slight_smile: