im tring to grab some text from existing webpage using this method :
try
{
WebClient client = new WebClient();
result = client.DownloadString(url);
int start = result.IndexOf("startpointstr") ;
end = result.IndexOf("EndpointStr");
result = result.Substring(start, end - start);
string.Format(
MessageBox.Show(result);
}
catch (Exception ex)
{
// handle error
MessageBox.Show(ex.Message);
}
in the positive side it works for english but for languages like Hebrew it returns unrecognised chars (not an hebrew language ) is there a way to reformat the returned string ?
Use the WebClient.Encoding Property to set the resource's encoding.
client.Encoding = System.Text.Encoding.UTF8;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With