I am using Visual Studio in C# (.Net 4.5). I made a simple program that has a single button. When I click it, it fetches the first five results of a Google query on Justin Trudeau, some of them in french, hence the "fr" in the query string. It then displays those results in a richTextBox, in a webBrowser, and in a MessageBox. But it doesn't display the french characters correctly. Why? Here's an image of the result: http://richardlatulippe.webs.com/result.png
And here is the code behind the button : ` (using System.IO;)
WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string query, html, result="", results="";
int start=0, end;
query = "https://www.google.com/search?q=justin+trudeau+fr";
html = wc.DownloadString(query);
for (int c=1; c<=5; c++)
{
start = html.IndexOf("\"r\"><a href", start) + 5;
start = html.IndexOf(">", start) + 1;
end = html.IndexOf("</a", start);
result = html.Substring(start, end-start);
if (!result.Contains("<img"))
{
results += result + "<br>";
result = result.Replace("<b>", "").Replace("</b>", "");
richTextBox1.Text += result + "\n";
}
}
webBrowser1.DocumentText = results;
MessageBox.Show(results);`