Today I use node-fetch and cheerio to fetch a webpage. It looks good in Chrome and Sublime Text when it displays html entities like
However, it does not render correctly in iTerm, Terminal and Visual Studio Code. It just shows fffd
I think the problem is because of my code, so I change to request and try to play with different options in cheerio but still the problem.
It didn’t take me long to figure it out that the format of the html is
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
So I need to use windows-1252, legacy-encoding, iconv-lite