Recieve ÅÄÖ with HttpWebRequest?
-
Hi! I'm having a problem with the HttpWebRequest - when I recieve the stream it looses the ÅÄÖ (and some other...). The Code:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create ("http://www.dvdforum.nu");
HttpWebResponse response = (HttpWebResponse)request.GetResponse ();StreamReader reader = new StreamReader (response.GetResponseStream ());
StreamWriter writer = new StreamWriter ("google.html");string buffer = "";
while ((buffer = reader.ReadLine ()) != null)
{
writer.WriteLine (buffer);
}reader.Close ();
writer.Close ();System.Diagnostics.Process.Start ("google.html");
Any idea how to fix this? Andreas Philipson
-
Hi! I'm having a problem with the HttpWebRequest - when I recieve the stream it looses the ÅÄÖ (and some other...). The Code:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create ("http://www.dvdforum.nu");
HttpWebResponse response = (HttpWebResponse)request.GetResponse ();StreamReader reader = new StreamReader (response.GetResponseStream ());
StreamWriter writer = new StreamWriter ("google.html");string buffer = "";
while ((buffer = reader.ReadLine ()) != null)
{
writer.WriteLine (buffer);
}reader.Close ();
writer.Close ();System.Diagnostics.Process.Start ("google.html");
Any idea how to fix this? Andreas Philipson
You need to provide an System.Text.Encoder to StreamReader and StreamWriter to handle the conversion from bytes to chars (it's not the same thing in .NET). Which one will be some guesswork, but they are only 4 or 5. :) lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
-
You need to provide an System.Text.Encoder to StreamReader and StreamWriter to handle the conversion from bytes to chars (it's not the same thing in .NET). Which one will be some guesswork, but they are only 4 or 5. :) lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
That was my first thought too, but none will give the right result :(. Andreas Philipson
-
Hi! I'm having a problem with the HttpWebRequest - when I recieve the stream it looses the ÅÄÖ (and some other...). The Code:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create ("http://www.dvdforum.nu");
HttpWebResponse response = (HttpWebResponse)request.GetResponse ();StreamReader reader = new StreamReader (response.GetResponseStream ());
StreamWriter writer = new StreamWriter ("google.html");string buffer = "";
while ((buffer = reader.ReadLine ()) != null)
{
writer.WriteLine (buffer);
}reader.Close ();
writer.Close ();System.Diagnostics.Process.Start ("google.html");
Any idea how to fix this? Andreas Philipson