473,372 Members | 828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

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 11730
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 Labria | 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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.