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. Advertisements

  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. Advertisements

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:
    12,604
    Joerg Jooss
    Apr 24, 2004
  2. =?Utf-8?B?QXNoYQ==?=
    Replies:
    3
    Views:
    612
  3. Arifi Koseoglu
    Replies:
    2
    Views:
    1,326
    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,688
    P.J. Plauger
    Aug 1, 2006
  5. darrel
    Replies:
    5
    Views:
    695
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    Apr 14, 2007
  6. darrel
    Replies:
    1
    Views:
    554
    darrel
    Apr 30, 2007
  7. H.S.
    Replies:
    12
    Views:
    1,604
    Victor Bazarov
    Aug 10, 2007
  8. Max Williams
    Replies:
    9
    Views:
    256
    Max Williams
    Jul 20, 2009
Loading...