View Single Post
  #1 (permalink)  
Old March 9th, 2004, 06:21 AM
HandSomeLi HandSomeLi is offline
Registered User
 
Join Date: Feb 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can I encode the stream?HELP!

I want to get the response stream from an Chinese web site.
but the chinese character were not encoded correctly.
 I don't know how to encode the chinese characters.

My codes of VB.NET in an ASP.NET project are as follows:



 Dim uri As New Uri("http://www.baidu.com/baidu?word=¤j&cl=3")
        Dim request As WebRequest = WebRequest.Create(uri)

        Dim respo As WebResponse = request.GetResponse

        Dim stream As Stream = respo.GetResponseStream
        Dim reader As New StreamReader(stream, Encoding.UTF8)

        Response.Write(reader.ReadToEnd)

        reader.Close()
        respo.Close()