473,466 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

document.write, HTML entities and IE

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
4 11737
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Robert Oschler | last post by:
Is there a module/function to remove all the HTML entities from an HTML document (e.g. - &nbsp, &amp, &apos, etc.)? If not I'll just write one myself but I figured I'd save myself some time. ...
1
by: chak | last post by:
I'm writting xml documents in french language. So i need to use special characters like é and ŕ. For this purpose i use HTML standard entities like é. But when i open my xml documents with my xml...
3
by: annoyed tuna | last post by:
I was wondering if someone could help me out. I'm trying to perform an XSL transformation on an XML document that uses entities. While I can do XSLT on a file without entities, it all falls apart...
4
by: Dennis M. Marks | last post by:
I generate a SELECT list dynamically by taking items from a table. I have DOCUMENT.WRITE statements that write a combination of literals and variables including < and > characters. The HTML seems...
2
by: Brett Baisley | last post by:
Hello I have a block of html code that I want to run by calling a javascript function to print it. Its basically a table with menu items in it that is the same for many pages, and instead of...
4
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400,...
3
by: Miquel Labňria | last post by:
When I load a document, it have text "&ntilde;" I recibe an error: Reference to undeclared entity, 'Ntilde' "Ntilde" is an entity of iso-8859-1, why load method can't load it. How can I refer...
4
by: ChillyRoll | last post by:
Hello guys, I am looking for a parser in PHP that can return all the attributes of XML entities. I know how to read the XML Entities, but I have got a problem with reading attributes. So I will...
6
by: clintonG | last post by:
Can anybody make sense of this crazy and inconsistent results? // IE7 Feed Reading View disabled displays this raw XML <?xml version="1.0" encoding="utf-8" ?> <!-- AT&T HTML entities & XML...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.