Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6648577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:40:19+00:00 2026-05-26T00:40:19+00:00

I have html page which has following line with some html entities like ’.

  • 0

I have html page which has following line with some html entities like “’”.

#Here I am not pasting whole html page content. just putting issue line only
html_file = "<html>....<body><p>they&#146;re originally intended to describe the spread of of viral diseases, but they&amp;#146;re nice analogies for how web/SN apps grow.<p> ...</body></html>"


doc   = Nokogiri::HTML(html)
body  = doc.xpath('//body')
body_content = body[0].inner_html

puts body_content  

Result:

These terms come from the fields of medicine and biology  they\u0092re originally intended to describe the spread of of viral diseases, but they\u0092re nice analogies for how web/SN apps grow.

I want to leave these entities as it is instead of changing it to unicode.
Any thing, Am I missing?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:40:20+00:00Added an answer on May 26, 2026 at 12:40 am
    they&#146;re
    

    is wrong and should be avoided. If you want to use a close-single-quote there, to reproduce the typographical practice of rendering apostrophes as a slanted quote, then the correct character is U+2019 RIGHT SINGLE QUOTATION MARK, which can be written as &#x2019; or &#8217;. Or, if you’re using UTF-8, just included verbatim as ’.

    &#146; should refer to character U+0092, a little-used and pointless control character that typically renders as blank or a missing-glyph box. And indeed in XML, it does.

    But in HTML (other than XHTML, which uses XML rules), it’s a long-standing browser quirk that character references in the range &#128; to &#159; are misinterpreted to mean the characters associated with bytes 128 to 159 in the Windows Western code page (cp1252) instead of the Unicode characters with those code points. The HTML5 standard finally documents this behaviour.

    The problem is that Nokogiri doesn’t know about this quirk, and takes character reference 146 at its word, ending up with the character 146 (\u0092) that you don’t really want. I think Nokogiri is using libxml2 to parse HTML, so ultimately the proper fix would be to libxml2’s htmlParseCharRef function, to substitute characters 128–159.

    In the meantime you could perhaps try ‘fixing up’ character references manually with crude string substitution like &#146;->&#x2019; before parsing. It’s a bit wrong, but at least in HTML the only other place you can have the markup sequence &#146; without it being a character reference would be in a comment, so hopefully it wouldn’t matter if you changed the content there accidentally too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an html page which has elements such as the following: <input data-required-by=books
I have written a HTML page which has following code. <div id=adsListContainer style=margin: 5px;>
I have an html page which has a link called open. Once the link
I have a page which has an Html.DropDownList which takes in a viewdata parameter.
I have a html page with a form. The form has Div which gets
I'd like to have an HTML page which displays a single PNG or JPEG
I have a HTML page with which I want to do some client side
I have a page (index.html) which has a frame: <html> <body> <iframe src=otherPage.html />
We have an HTML page which displays a bunch of pretty bars using divs
I have this html page which is very simple, it contains a text box

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.