Last active
December 11, 2015 21:58
-
-
Save jamietre/4666146 to your computer and use it in GitHub Desktop.
Arabic encoding test with CsQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test, TestMethod] | |
public void TestArabic() | |
{ | |
bool done = false; | |
string content = null; | |
CQ dom; | |
CQ.CreateFromUrlAsync("http://www.ahram.org.eg/Stars-Arts/News/194972.aspx") | |
.Then(response => | |
{ | |
dom = response.Dom; | |
content = string.Empty; | |
content = dom["#txtBody > p"].Text(); | |
done = true; | |
}); | |
WebClient client = new WebClient(); | |
client.Encoding = System.Text.Encoding.UTF8; | |
string b = client.DownloadString("http://www.ahram.org.eg/Stars-Arts/News/194972.aspx"); | |
var dom2 = CQ.Create(b); | |
var content2 = dom2["#txtBody > p"].Text(); | |
while (done == false) ; | |
Assert.AreEqual(content, content2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment