Home All Groups Group Topic Archive Search About
Author
24 Sep 2006 2:44 PM
Leon_Amirreza
thought my post is too long the short version is:
i have this tag in my HTML file served by IIS

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

IE show this page correctly but I need to detect the characterset of the
response and

          HttpWebResponse webresp = (HttpWebResponse)(webrq.GetResponse());
        ...
        console.WriteLine(webresp.CharacterSet);

dumps this on screen

ISO-8859-1

instead of utf-8 ! why?

Author
24 Sep 2006 4:25 AM
Gaurav Vaish (www.EduJiniOnline.com)
While making a request, add a "Accept-Charset" header with appropriate
values.
An example may be:

Accept-Charset: utf-8

See "Section 14" of RFC-2616.
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html


Show quote
"Leon_Amirreza" <amirreza_rahm***@yahoo.com> wrote in message
news:%23DuRsby3GHA.1060@TK2MSFTNGP04.phx.gbl...
> thought my post is too long the short version is:
> i have this tag in my HTML file served by IIS
>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>
> IE show this page correctly but I need to detect the characterset of the
> response and
>
>          HttpWebResponse webresp = (HttpWebResponse)(webrq.GetResponse());
>        ...
>        console.WriteLine(webresp.CharacterSet);
>
> dumps this on screen
>
> ISO-8859-1
>
> instead of utf-8 ! why?
>
>
>
Author
25 Sep 2006 6:13 AM
Leon_Amirreza
Thanks for the useful link and comment.
Any way I can force the IIS to send the page in the charset I want when
there is no accept-charset in the request header (something like default
charset option in the server)?


"Gaurav Vaish (www.EduJiniOnline.com)"
<gaurav.vaish.nospam@nospam.gmail.com> wrote in message
Show quote
news:eLk$HG53GHA.4972@TK2MSFTNGP03.phx.gbl...
> While making a request, add a "Accept-Charset" header with appropriate
> values.
> An example may be:
>
> Accept-Charset: utf-8
>
> See "Section 14" of RFC-2616.
>    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>
>
> --
> Happy Hacking,
> Gaurav Vaish | http://www.mastergaurav.com
> http://www.edujinionline.com
> http://articles.edujinionline.com/webservices
> -------------------
>
>
> "Leon_Amirreza" <amirreza_rahm***@yahoo.com> wrote in message
> news:%23DuRsby3GHA.1060@TK2MSFTNGP04.phx.gbl...
>> thought my post is too long the short version is:
>> i have this tag in my HTML file served by IIS
>>
>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>>
>> IE show this page correctly but I need to detect the characterset of the
>> response and
>>
>>          HttpWebResponse webresp =
>> (HttpWebResponse)(webrq.GetResponse());
>>        ...
>>        console.WriteLine(webresp.CharacterSet);
>>
>> dumps this on screen
>>
>> ISO-8859-1
>>
>> instead of utf-8 ! why?
>>
>>
>>
>
>
Author
24 Sep 2006 9:04 AM
Gaurav Vaish (www.EduJiniOnline.com)
> Thanks for the useful link and comment.
> Any way I can force the IIS to send the page in the charset I want when
> there is no accept-charset in the request header (something like default
> charset option in the server)?

It's not the IIS that sends the charset.
It's in the ASPX page itself. Add an attribute to the page directive.

<%@ Page ContentType="text/html; charset=utf-8" ... %>



Author
25 Sep 2006 7:30 AM
Leon_Amirreza
adding Accept-Charset: utf-8 didnt solve the problem:

webrq.Headers.Add(HttpRequestHeader.AcceptCharset, Encoding.UTF8.WebName);

I dunno what is wrong with it?

Show quote
"Leon_Amirreza" <amirreza_rahm***@yahoo.com> wrote in message
news:uuH26i63GHA.512@TK2MSFTNGP06.phx.gbl...
> Thanks for the useful link and comment.
> Any way I can force the IIS to send the page in the charset I want when
> there is no accept-charset in the request header (something like default
> charset option in the server)?
>
>
> "Gaurav Vaish (www.EduJiniOnline.com)"
> <gaurav.vaish.nospam@nospam.gmail.com> wrote in message
> news:eLk$HG53GHA.4972@TK2MSFTNGP03.phx.gbl...
>> While making a request, add a "Accept-Charset" header with appropriate
>> values.
>> An example may be:
>>
>> Accept-Charset: utf-8
>>
>> See "Section 14" of RFC-2616.
>>    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>>
>>
>> --
>> Happy Hacking,
>> Gaurav Vaish | http://www.mastergaurav.com
>> http://www.edujinionline.com
>> http://articles.edujinionline.com/webservices
>> -------------------
>>
>>
>> "Leon_Amirreza" <amirreza_rahm***@yahoo.com> wrote in message
>> news:%23DuRsby3GHA.1060@TK2MSFTNGP04.phx.gbl...
>>> thought my post is too long the short version is:
>>> i have this tag in my HTML file served by IIS
>>>
>>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>>>
>>> IE show this page correctly but I need to detect the characterset of the
>>> response and
>>>
>>>          HttpWebResponse webresp =
>>> (HttpWebResponse)(webrq.GetResponse());
>>>        ...
>>>        console.WriteLine(webresp.CharacterSet);
>>>
>>> dumps this on screen
>>>
>>> ISO-8859-1
>>>
>>> instead of utf-8 ! why?
>>>
>>>
>>>
>>
>>
>
>

AddThis Social Bookmark Button