By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,916 Members | 1,286 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,916 IT Pros & Developers. It's quick & easy.

document.write, HTML entities and IE

P: n/a
I must confess I only come here when I have a problem - so my apologies
if this has been raised before:

Using my IE v.6 browser, document.write doesn't convert HTML entities
(e.g. ', &) to the appropriate character (though NS 6.2 works
fine).

Obviously I can get round this for particular entities by writing some
code to do the conversion before using document.write - but I need a
more general solution that will catch any of the HTML entities.

A trawl with Google has found a number of people raising the question,
but no answers. Any suggestions?

--
Best wishes,

Geoff Wilkins
Ge****@wordsmith.demon.co.uk
Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <t5**************@wordsmith.demon.co.uk>, Geoff Wilkins
<Ge****@wordsmith.demon.co.uk> writes:
Using my IE v.6 browser, document.write doesn't convert HTML entities
(e.g. &apos;, &) to the appropriate character (though NS 6.2 works
fine).


IE6 doesn't convert &apos; to an apostrophe even when its hard-coded.

&apos;test&apos; in a test page, in NS7 displays 'test' while in IE6, it
displays as written. So its not the document.write thats failing, its the
browser itself in its HTML side. Note: It does convert &copy; to the copyright
symbol, whether hard coded or document.write generated.
--
Randy
Jul 20 '05 #2

P: n/a
Many thanks for this - I should have experimented a little more before
asking.

Are there any other HTML entities that IE6 doesn't convert?

In message <20***************************@mb-m01.aol.com>,
HikksNotAtHome <hi************@aol.com> writes
In article <t5**************@wordsmith.demon.co.uk>, Geoff Wilkins
<Ge****@wordsmith.demon.co.uk> writes:
Using my IE v.6 browser, document.write doesn't convert HTML entities
(e.g. &apos;, &) to the appropriate character (though NS 6.2 works
fine).


IE6 doesn't convert &apos; to an apostrophe even when its hard-coded.

&apos;test&apos; in a test page, in NS7 displays 'test' while in IE6, it
displays as written. So its not the document.write thats failing, its the
browser itself in its HTML side. Note: It does convert &copy; to the copyright
symbol, whether hard coded or document.write generated.


--
Best wishes,

Geoff Wilkins
Ge****@wordsmith.demon.co.uk
Jul 20 '05 #3

P: n/a
In article <pY**************@wordsmith.demon.co.uk>, Geoff Wilkins
<Ge****@wordsmith.demon.co.uk> writes:

Please don't top-post.
Many thanks for this - I should have experimented a little more before
asking.

Are there any other HTML entities that IE6 doesn't convert?


http://www.cs.indiana.edu/elisp/entities-list.html

Seems to be a pretty good start. Not sure if its a "complete" list of all the
HTML Entities, its a list of whats in Emacs browser.

Some of those don't display in NS7 either.

--
Randy
Jul 20 '05 #4

P: n/a
DU
HikksNotAtHome wrote:
In article <t5**************@wordsmith.demon.co.uk>, Geoff Wilkins
<Ge****@wordsmith.demon.co.uk> writes:

Using my IE v.6 browser, document.write doesn't convert HTML entities
(e.g. &apos;, &) to the appropriate character (though NS 6.2 works
fine).

IE6 doesn't convert &apos; to an apostrophe even when its hard-coded.

&apos;test&apos; in a test page, in NS7 displays 'test' while in IE6, it
displays as written. So its not the document.write thats failing, its the
browser itself in its HTML side. Note: It does convert &copy; to the copyright
symbol, whether hard coded or document.write generated.


Character entity references in HTML 4
http://www.w3.org/TR/html401/sgml/entities.html

"The named character reference &apos; (the apostrophe, U+0027) was
introduced in XML 1.0 but does not appear in HTML. Authors should
therefore use ' instead of &apos; to work as expected in HTML 4 user
agents."
C.16. The Named Character Reference &apos;
http://www.w3.org/TR/2002/REC-xhtml1-20020801/#C_16

I tested
document.write("&amp; '");
in MSIE 6 SP2 for windows in an HTML 4.01 strict DTD and it worked
without a problem.

I then tested
document.write("&amp; &apos;");
in MSIE 6 SP2 for windows in an XHTML 1.0 strict DTD and &apos; was not
converted into an '. \u0027 worked though.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.