[Mono-list] HttpWebResponse : Encoding info (Mono better than .Net ???)

xiii29 at free.fr xiii29 at free.fr
Mon Nov 13 07:56:07 EST 2006


Hi,

My apps make a request on internet with an HttpWebRequest and an
HttpWebResponse. For some weeks I got trouble with specials char (é, à, ù
[...]).

I find a solution :
// -1- get response
HttpWebResponse objHttpReponse = objHttpRequest.GetResponse();
// -2- Get the stream
objStream = objHttpReponse.GetResponseStream();
// -3- Create a reader to manipulate the stream :
StreamReader objReader = new StreamReader(objStream,
Encoding.GetEncoding(objHttpReponse.CharacterSet));

As you can see, I give the CharacterSet to the GetEncoding method.

On Mono/Linux, no trouble, I've something in the CharacterSet and the
StreamReader  is well created. ("et j'ai mes accents !!!!" :-)).

I compiler my apps goes on .Net/Windows and ... :
System.ArgumentException:  is not a supported encoding name.
Parameter name: name
   at System.Globalization.EncodingTable.internalGetCodePageFromName(String name
)
   at System.Globalization.EncodingTable.GetCodePageFromName(String name)


>From what I see Character Set is empty ...

My question :
Why in Mono/Linux the field is ok and not on .Net/Windows ?

Thanks !



More information about the Mono-list mailing list