( turns into a "(" was displayed as a "'" in the browser.

13 views
Skip to first unread message

Justin

unread,
Aug 30, 2012, 7:48:31 PM8/30/12
to nokogi...@googlegroups.com
# Given the following code
html = "<div id='test'>Johnson&#40;s law: Systems resemble the organizations that create them</div>"
parsed = Nokogiri::HTML::DocumentFragment.parse(html)

# I get this:
parsed.to_html
-->   "<div id=\"test\">Johnson(s law: Systems resemble the organizations that create them</div>"

On the original page where I got the html (http://motd.ambians.com/quotes.php/name/freebsd_fortunes_4/toc_id/1-0-5/s/1941) the '&#40;' showed up as an apostrophe.

I'm guessing that I'm not encoding something properly. Anyone know how to keep that html code as an apostrophe?

Thanks,
Justin
Reply all
Reply to author
Forward
0 new messages