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.
Diogo do Nascimento (Guest)
on 2008-10-23 17: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.
Hannes R. (Guest)
on 2008-10-27 17: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.