Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.text() should decode HTML entities #52

Closed
rybesh opened this issue Apr 13, 2012 · 4 comments
Closed

.text() should decode HTML entities #52

rybesh opened this issue Apr 13, 2012 · 4 comments

Comments

@rybesh
Copy link

rybesh commented Apr 13, 2012

jQuery .text() decodes HTML entities:

> $('<p>M&amp;M</p>').text()
"M&M"

cheerio's does not:

> cheerio.load("<p>M&amp;M</p>")("p").text()
'M&amp;M'
@matthewmueller
Copy link
Member

Ahh yah, there's some encoding/decoding problems that need to be addressed - just need to find the time to resolve these issues.

@acsaga
Copy link

acsaga commented May 29, 2012

@matthewmueller
In which file I can find the encoding/decoding methods?
I want to have a quick fix myself before you release your official patch.

Thanks!

@matthewmueller
Copy link
Member

Hi @acsaga , I haven't added them yet - I've been caught up on some other features. If you create a fix for this, I'd encourage you to open up a pull request.

@lookfirst
Copy link

For what it is worth, I 'solved' this issue by just using jsdom.

entities = require('jsdom/lib/jsdom/browser/htmlencoding')
entities.HTMLDecode('&#39;')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants