question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.html() method returns html with UNICODE when Chinese words are passed

See original GitHub issue
var cheerio = require('cheerio');
var $ = cheerio.load('<title>文章抓取</title>');
console.log($('title').html());

<=0.15.0 output:

文章抓取 

0.16.0-0.17.0 output:

&#x6587;&#x7AE0;&#x6293;&#x53D6;

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

14reactions
fb55commented, Sep 22, 2014

Try passing decodeEntities: false.

0reactions
indatawetrustcommented, Mar 27, 2019

@fb55 thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Display Chinese Text on Web Page - html - Stack Overflow
Sometimes the actual file encoding is wrong. Try opening the output file in say "Notepad++" and see what encoding it detects in bottom...
Read more >
htmlspecialchars - Manual - PHP
Certain characters have special significance in HTML, and should be represented by HTML entities if they are to preserve their meanings. This function...
Read more >
PHP htmlspecialchars() Function - W3Schools
The htmlspecialchars() function converts some predefined characters to HTML entities. The predefined characters are: ... Tip: To convert special HTML entities ...
Read more >
Structural markup and right-to-left text in HTML - W3C
This article looks at ways of handling text direction for structural markup in HTML, ie. at the document level and for elements like ......
Read more >
UTF-8: The Secret of Character Encoding - HTML Purifier
PHP header() function; PHP ini directive; Non-PHP .htaccess; File extensions. XML; Inside the process. Why UTF-8? Internationalization; User-friendly; Forms.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found