reading non-english html pages with c#

Posted by Gal Miller on Stack Overflow See other posts from Stack Overflow or by Gal Miller
Published on 2010-06-09T17:59:02Z Indexed on 2010/06/09 18:02 UTC
Read the original article Hit count: 288

Filed under:
|
|

I am trying to find a string in Hebrew in a website. The reading code is attached.

Afterward I try to read the file using streamReader but I can't match strings in other languages. what am I suppose to do?

   // used on each read operation
    byte[] buf = new byte[8192];

    // prepare the web page we will be asking for
    HttpWebRequest request = (HttpWebRequest)
        WebRequest.Create("http://www.webPage.co.il");

    // execute the request
    HttpWebResponse response = (HttpWebResponse)
        request.GetResponse();

    // we will read data via the response stream
    Stream resStream = response.GetResponseStream();

    string tempString = null;
    int count = 0;
    FileStream fileDump = new FileStream(@"c:\dump.txt", FileMode.Create);
    do
    {
        count = resStream.Read(buf, 0, buf.Length);
        fileDump.Write(buf, 0, buf.Length);

    }
    while (count > 0); // any more data to read?

    fileDump.Close();

© Stack Overflow or respective owner

Related posts about html

Related posts about unicode