IE DOM encoding

P

Provost Zakharov

Hello,
I just needed some help on how the DOM is encoded by the IE
parser.
As per the MSDN page,
http://msdn.microsoft.com/workshop/author/dhtml/reference/charsets/charset4.asp
,server encodings are considered first,then the <meta> tag specified
encodings and then finally the user's preferred settings(which is
usually Western-European aka windows-1252).

I used Ethereal to packet sniff the traffic to www.baidu.com .There is
no encoding specified in the content-type header on this site .Also,
the preferred encoding is specified in the <meta> tags as gb2312
..However ie.Document.charset returns the value windows-1252.
My question is this...which encoding is being used by the parser to
actually encode the page?Is it the default user encoding or the <meta>
tag encoding?And if the default user encoding is being used to encode
the content ,isn't that contradictory to what is specified on the page
above?

Thanks
Provost Zak
 
M

Martin Honnen

Provost said:
I just needed some help on how the DOM is encoded by the IE
parser.

Independent of the encoding of a HTML document I am pretty sure that
strings in IE's DOM implementation are sequences of Unicode letters,
internally probably UTF-16 encoded.
For instance the innerText property is documented here
<http://msdn.microsoft.com/library/d...l/reference/ifaces/ihtmlelement/innertext.asp>
as a BSTR, tagName too
<http://msdn.microsoft.com/library/d...reference/ifaces/ihtmlelement/get_tagname.asp>

For your J(ava)Script code strings are sequences of Unicode characters
too so you don't have anything to change just because the server is
sending a HTML document in a different encoding.
I used Ethereal to packet sniff the traffic to www.baidu.com .There is
no encoding specified in the content-type header on this site .Also,
the preferred encoding is specified in the <meta> tags as gb2312
.However ie.Document.charset returns the value windows-1252.
My question is this...which encoding is being used by the parser to
actually encode the page?

The browser does not need to _encode_ the "page" at all, rather it needs
to _decode_ the body of the HTTP response it gets from the HTTP server,
meaning it needs to decode the byte sequence in the response body to a
sequence of characters.
Is it the default user encoding or the <meta>
tag encoding?And if the default user encoding is being used to encode
the content ,isn't that contradictory to what is specified on the page
above?

I fail to see what that question has to do with JavaScript, how a
browser deals with a HTTP response, with HTTP response headers, with
meta elements in text/html response is not depending on or related to
JavaScript.
 
P

Provost Zakharov

Hello,
Thanks for the response.I'm aware that this is a community for
Javascript questions. I just couldn't find any other community to post
a question about the IE DOM .Any suggestions would be highly welcome.

Thanks
Provost Zak
 
M

Martin Honnen

Provost said:
I'm aware that this is a community for
Javascript questions. I just couldn't find any other community to post
a question about the IE DOM .Any suggestions would be highly welcome.

The IE DOM, if manipulated with J(ava)Script, is on topic here. But you
rather seem to want to know or discuss how IE deals with HTTP response
headers and/or meta element and/or user preferences in case of text/html
delivered to it. That does not depend on JavaScript in my view and is
better dealt with in an IE specific group (where news.microsoft.com has
lots of groups to offer) or in terms of HTML authoring in a group like
comp.infosystems.www.authoring.html.
 
P

Provost Zakharov

Hello,
Thanks for the help.
Rgds
Provost Zak
Martin said:
The IE DOM, if manipulated with J(ava)Script, is on topic here. But you
rather seem to want to know or discuss how IE deals with HTTP response
headers and/or meta element and/or user preferences in case of text/html
delivered to it. That does not depend on JavaScript in my view and is
better dealt with in an IE specific group (where news.microsoft.com has
lots of groups to offer) or in terms of HTML authoring in a group like
comp.infosystems.www.authoring.html.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top