M
Marcus Strube
Can someone tell me what it is that I'm getting wrong here with "iconv"?
I either get "IllegalSequence" or "äöüß" are not encoded properly when
using Iconv.conv while it looks good using backticks. ("IllegalSequence
right now with the second. ÄÖü with the first anytime...)
require 'rss/1.0'; require 'rss/2.0'; require 'open-uri'; require
"iconv"
#source = "http://www.sueddeutsche.de/app/service/rss/alles/rss.xml"
source = "http://www.welt.de/vermischtes/?service=Rss"
content = ""; open(source) { |s| content = s.read }; rss =
RSS:arser.parse(content, false)
rss.items.each do |item|
converted = `'#{item.title}' | iconv -c -f ISO-8859-1 -t UTF8`
puts(Iconv.conv('ISO-8859-1', 'UTF-8', item.title)); puts " "
end
I either get "IllegalSequence" or "äöüß" are not encoded properly when
using Iconv.conv while it looks good using backticks. ("IllegalSequence
right now with the second. ÄÖü with the first anytime...)
require 'rss/1.0'; require 'rss/2.0'; require 'open-uri'; require
"iconv"
#source = "http://www.sueddeutsche.de/app/service/rss/alles/rss.xml"
source = "http://www.welt.de/vermischtes/?service=Rss"
content = ""; open(source) { |s| content = s.read }; rss =
RSS:arser.parse(content, false)
rss.items.each do |item|
converted = `'#{item.title}' | iconv -c -f ISO-8859-1 -t UTF8`
puts(Iconv.conv('ISO-8859-1', 'UTF-8', item.title)); puts " "
end