# Hpricot Html Parsing

**URL:** <https://www.ruby-forum.com/t/hpricot-html-parsing/114535>\
**Category:** Ruby\
**Created:** [September 14, 2007, 10:34am UTC](https://www.ruby-forum.com/t/hpricot-html-parsing/114535 "2007-09-14T10:34:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![suja](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@suja](https://www.ruby-forum.com/u/suja)\
**Post date:** [September 14, 2007, 10:34am UTC](https://www.ruby-forum.com/t/hpricot-html-parsing/114535/1 "2007-09-14T10:34:41Z")

</div>

Hi,  
I’m getting funky characters, when parsing html using Hpricot.  
How to remove this funky character?

Anyone have a fix / workaround for this?

thanks in advance,  
Suja

---

<div class="post-metadata">

**Author:** ![suja](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@suja](https://www.ruby-forum.com/u/suja)\
**Post date:** [September 15, 2007, 11:17am UTC](https://www.ruby-forum.com/t/hpricot-html-parsing/114535/2 "2007-09-15T11:17:42Z")

</div>

Suja JS wrote:

> Hi,  
> I’m getting funky characters, when parsing html using Hpricot.  
> How to remove this funky character?
> 
> Anyone have a fix / workaround for this?
> 
> thanks in advance,  
> Suja

Could you describe these ‘funky characters’?

---

<div class="post-metadata">

**Author:** ![suja](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@suja](https://www.ruby-forum.com/u/suja)\
**Post date:** [September 15, 2007, 11:22am UTC](https://www.ruby-forum.com/t/hpricot-html-parsing/114535/3 "2007-09-15T11:22:56Z")

</div>

Lee J. wrote:

> Suja JS wrote:
> 
> > Hi,  
> > I’m getting funky characters, when parsing html using Hpricot.  
> > How to remove this funky character?
> > 
> > Anyone have a fix / workaround for this?
> > 
> > thanks in advance,  
> > Suja
> 
> Could you describe these ‘funky characters’?

Like ‘ï¿½’ in this text.  
“By Mike Monson CHAMPAIGN ï¿½ Effective today the city of Champaign is  
closing three bridges and posting load limits on three others.”

---

<div class="post-metadata">

**Author:** ![suja](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@suja](https://www.ruby-forum.com/u/suja)\
**Post date:** [September 17, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/hpricot-html-parsing/114535/4 "2007-09-17T13:23:11Z")

</div>

Hi Suja,

two suggestions:

- check the encoding used by the page you’re hashpricoting (doh -  
think I just invented a verb, or what).
- puts $KCODE to see if you’re running in unicode or not. If you are  
hashpricoting a page encoded in UTF-8, but KCODE is set to none (or if  
the page is in latin1, but KCODE is set to U), then you’ll have to  
change the encoding using iconv for instance.

cheers

Thibaut

---

<div class="post-metadata">

**Author:** ![suja](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@suja](https://www.ruby-forum.com/u/suja)\
**Post date:** [September 17, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/hpricot-html-parsing/114535/5 "2007-09-17T13:23:48Z")

</div>

> “By Mike Monson CHAMPAIGN ? Effective today the city of Champaign is  
> closing three bridges and posting load limits on three others.”

hint hint :  
[http://www.news-gazette.com/news/local/2007/09/14/city\_closes\_three\_bridges\_limits\_loads](http://www.news-gazette.com/news/local/2007/09/14/city_closes_three_bridges_limits_loads)

The minus character you see after CHAMPAIGN is not a regular “-”.
