Vinod Kumar

Vinod Kumar

  • NA
  • 19
  • 22.4k

i have one url of japan when i my craweling the site then give problem of encode the reponse url is http://www.alamo.jp

Feb 6 2013 4:20 AM
 HttpWebRequest webReq = null;

            HttpWebResponse webRes = null;

    
            webReq = (HttpWebRequest)(WebRequest.Create("http://www.alamo.jp/"));


         

            webRes = (HttpWebResponse)webReq.GetResponse();

            Stream resStream = webRes.GetResponseStream();

            String strResponse = resStream.ToString();

            string Result = string.Empty;

            StringBuilder StrgBuilder = new StringBuilder();

            byte[] Buffer = new byte[8192];

            int Count = 0;

            do
            {

                Count = resStream.Read(Buffer, 0, Buffer.Length);

                if (Count != 0)
                {

                    Result = Encoding.ASCII.GetString(Buffer, 0, Count);

                    StrgBuilder.Append(Result);

                }

            } while (Count > 0);

            Result = StrgBuilder.ToString();

            // Result = Regex.Replace(Result, "<HEAD>", "<HEAD> <base href=\"http://www.avis.com/\">", RegexOptions.IgnoreCase);


            ////StreamWriter sw = new StreamWriter("C://yahoo.html", false, Encoding.UTF8);

            //sw.Write(Result);
            return Result;