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

Kornél Pál kornelpal at gmail.com
Mon Nov 13 07:38:17 EST 2006


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

Please let us know the exact objHttpReponse.CharacterSet value(s) that you 
experienced causing ArgumentException because that helps to understand the 
problem.

Kornél

----- Original Message ----- 
From: <xiii29 at free.fr>
To: "Mono List" <mono-list at lists.ximian.com>
Sent: Monday, November 13, 2006 1:56 PM
Subject: [Mono-list] HttpWebResponse : Encoding info (Mono better than 
.Net???)


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 !

_______________________________________________
Mono-list maillist  -  Mono-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list 



More information about the Mono-list mailing list