473,796 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ 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****@wordsmit h.demon.co.uk
Jul 20 '05 #1
4 11765
In article <t5************ **@wordsmith.de mon.co.uk>, Geoff Wilkins
<Ge****@wordsmi th.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.de mon.co.uk>, Geoff Wilkins
<Ge****@wordsm ith.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&apo s; 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****@wordsmit h.demon.co.uk
Jul 20 '05 #3
In article <pY************ **@wordsmith.de mon.co.uk>, Geoff Wilkins
<Ge****@wordsmi th.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.de mon.co.uk>, Geoff Wilkins
<Ge****@wordsmi th.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
12303
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. Thanks, -- Robert
1
1731
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 viewer an XML Parsing Error(undefined entity) occur. It seems to me quite normal as entity like é are not part of xml standard. I found on google a file called iso-lat1.ent (part of DocBook project) which defined all entities i need.
3
1430
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 when I try and add an entity. Here are my files... -----TEST.XML------ <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <!DOCTYPE document >
4
2829
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 to work all right but validators show errors of having a closing > without an opening <. Even though these are in DOCUMENT.WRITE statements within quotes they are still flagged as errors. Is there any way around this. I have tried HTML entities...
2
2386
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 copying/pasting everytime I change it, I figure this will be better, as I only change it once. The problem is, document.write doesn't handle multiple lines very well, so I was wondering what is the best way to do this? Maybe there is even a better...
4
2954
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, like DOS, uses memory-mapped display, two bytes per character (one char byte and one attribute byte). We can get the screen offset allright, and I've written a javascript which does the math to convert the offset into row/col (i.e. left, top)...
3
2903
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 entities ISO-8859-1? Please help me...
4
3220
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 appreciate if you could give a parser that can return all the Entities and Attributes of respective entities as an array. For e.g.: <?xml version="1.0" ?>
6
10170
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 <elementsare displayed --> <rss version="2.0"> <channel> <title>AT&T HTML entities & XML <elementsare displayed</title> .... <description>
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9524
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6785
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
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 we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.