Skip to content

Instantly share code, notes, and snippets.

@jamietre
Last active December 11, 2015 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamietre/4666146 to your computer and use it in GitHub Desktop.
Save jamietre/4666146 to your computer and use it in GitHub Desktop.
Arabic encoding test with CsQuery
[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