UTF-8 out of Hpricot

Discussion in 'Ruby' started by Diogo do Nascimento, Oct 23, 2008.

  1. 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.
    Diogo do Nascimento, Oct 23, 2008
    #1
    1. Advertising

  2. 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")))
    --
    Posted via http://www.ruby-forum.com/.
    Hannes Rammer, Oct 27, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JJBW
    Replies:
    1
    Views:
    10,061
    Joerg Jooss
    Apr 24, 2004
  2. =?Utf-8?B?QXNoYQ==?=
    Replies:
    3
    Views:
    416
  3. Arifi Koseoglu
    Replies:
    2
    Views:
    953
    Arifi Koseoglu
    Apr 13, 2004
  4. Jimmy Shaw

    Converting from UTF-16 to UTF-32

    Jimmy Shaw, Jul 31, 2006, in forum: C++
    Replies:
    7
    Views:
    1,303
    P.J. Plauger
    Aug 1, 2006
  5. Max Williams
    Replies:
    9
    Views:
    125
    Max Williams
    Jul 20, 2009
Loading...

Share This Page