Forum: Ruby UTF-8 out of Hpricot

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dd3edf8c4d5edce2cfb1975edd4ff552?d=identicon&s=25 Diogo do Nascimento (Guest)
on 2008-10-23 15:37
(Received via mailing list)
Hey,
I'm trying to get some text out of an Hpricot Element but it's not
giving me the correct encoding. The text displays alright when I
inspect the element.
I've already set $KCODE to 'U'
Thks.
Eda347edde75a053c4b5a7261426c2e1?d=identicon&s=25 Hannes Rammer (monstars99)
on 2008-10-27 16:51
Diogo do Nascimento wrote:
> Hey,
> I'm trying to get some text out of an Hpricot Element but it's not
> giving me the correct encoding. The text displays alright when I
> inspect the element.
> I've already set $KCODE to 'U'
> Thks.


that works for me


    f = open(http://google.de/)
    f.rewind
    doc = Hpricot(Iconv.conv('utf-8', f.charset,
f.readlines.join("\n")))
This topic is locked and can not be replied to.