jamietre / CsQuery

CsQuery is a complete CSS selector engine, HTML parser, and jQuery port for C# and .NET 4.
Other
1.16k stars 250 forks source link

Unable to do comparison with Chinese text #156

Open eloitay opened 10 years ago

eloitay commented 10 years ago

Hi This is my code sample, I had removed the site that I tested the code against since it is some intranet environment. So basically what I notice is the comparison is not matching due to the InnerText being encoded. So I tried to use decoding method from .NET framework and HTMLAgilityPack but it does not seem to decode to the correct original Chinese text. Any clue what is missing here?

var cq = CQ cq = CQ.CreateFromUrl("www.google.com"); var lastPage = cq["a"].Where(x => x.InnerText == "尾页");

I tried something like this var lastPage = cq["a"].Where(x => System.Net.WebUtility.HtmlDecode(x.InnerText) == "尾页");