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

&nbsp works in internet explorer but problem using in firefox 1.0.4

P: n/a
I have the following line of html:

 &nbsp1234    &nbspabc&nb sp; &nbspyow

In Internet Explorer 6.0, the columns look ok using the above html:

1234 abcd yow
But, in firefox, for same html, getting this:

&nbsp1234 &nbspabcd yow

Does anyone know why I might be getting &nbsp in the output of my html
using firefox?
Thanks for any advice on this.

Entfred

Aug 14 '06 #1
Share this Question
Share on Google+
28 Replies


P: n/a
Nik
en*****@hotmail.com wrote:
I have the following line of html:

 &nbsp1234    &nbspabc&nb sp; &nbspyow

In Internet Explorer 6.0, the columns look ok using the above html:
1234 abcd yow
But, in firefox, for same html, getting this:
&nbsp1234 &nbspabcd yow
The answer is in your code - the semicolon ';' is important to define
the end of the special character.

IE thinks it knows what you want, and displays it for you. FF knows
that it cannot possibly know what you want and displays what you have
entered.

The fact that IE is correct in this instance does not stop opinion being
divided(*) as to whether or not it is the 'right' behaviour.

Nik

* Less divided in c.i.w.a.h., where those who speak against the
all-encompassing adoption of all standards in all cases have been
provoked and hounded out.
Aug 14 '06 #2

P: n/a
en*****@hotmail.com writes:
I have the following line of html:

 &nbsp1234    &nbspabc&nb sp; &nbspyow

In Internet Explorer 6.0, the columns look ok using the above html:

1234 abcd yow
But, in firefox, for same html, getting this:

&nbsp1234 &nbspabcd yow

Does anyone know why I might be getting &nbsp in the output of my html
using firefox?
Several of those   entities are missing the required ; at the end. IE
happens to handle the error by doing more or less what you want, but FireFox
is handling it differently.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Aug 14 '06 #3

P: n/a
Rik
Nik wrote:
en*****@hotmail.com wrote:
>I have the following line of html:

 &nbsp1234    &nbspabc&n bsp; &nbspyow

In Internet Explorer 6.0, the columns look ok using the above html:
1234 abcd yow
But, in firefox, for same html, getting this:
&nbsp1234 &nbspabcd yow

The answer is in your code - the semicolon ';' is important to define
the end of the special character.

IE thinks it knows what you want, and displays it for you. FF knows
that it cannot possibly know what you want and displays what you have
entered.

The fact that IE is correct in this instance does not stop opinion
being divided(*) as to whether or not it is the 'right' behaviour.
Well, I'd hate for MSIE to output a space when I mean &nbsp, but then again
it would offcourse be written as &nbsp :-)

Grtz,
--
Rik Wasmus
Aug 14 '06 #4

P: n/a
The &nbsp works fine in Firefox and Netscape, now that I put the ; at
the end of each one:

  

Now, another problem that is a result of testing on firefox and
netscape, where
the html works good on IE, but not good on Firefox or Netscape.

<table width="300" border="0" align="center">

<tr align="center">
abcd
</tr>

<tr align="center">
1234
</tr>
<tr align="center">
XYZ9
</tr>

<td width="32%" align="center">
</td>
</table>

The above html using the <trstatement does not work in firefox or
netscape, but
works fine in IE. In firefox or netscape, the columns run together:

abcd 1234 XYZ9

This is incorrect, since I want abcd to be on a separate line (and 1234
and XYZ9 to
be on separate lines).

In IE, the html makes it look like this:

abcd
1234
XYZ9

This is the way I want the html to look. It is a little weird that the
major browsers
do not handle the html in the same exact way.

---- Entfred

Aug 14 '06 #5

P: n/a
en*****@hotmail.com writes:
The &nbsp works fine in Firefox and Netscape, now that I put the ; at
the end of each one:

&nbsp;&nbsp;
In other words, once you fixed the error in your code, FF & NS were able
to display the correct code correctly.

Imagine that.
Now, another problem that is a result of testing on firefox and
netscape, where
the html works good on IE, but not good on Firefox or Netscape.

<table width="300" border="0" align="center">

<tr align="center">
abcd
</tr>

<tr align="center">
1234
</tr>
<tr align="center">
XYZ9
</tr>

<td width="32%" align="center">
</td>
</table>
This is not a different problem, it is the same problem as before. Your HTML
is broken, and you're assuming that the result you're getting from IE is the
"correct" way to render what you've given it.

That assumption is flawed, because there is *no* correct way to display the
above. It's invalid markup, and any browser is free to display it in whatever
way it wants.

You really need to read some basic tutorials on how HTML must be written -
you can't just make stuff up and expect it to work consistently.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Aug 14 '06 #6

P: n/a
en*****@hotmail.com wrote:
The &nbsp works fine in Firefox and Netscape, now that I put the ; at
the end of each one:

&nbsp;&nbsp;
...which is correct, as previously stated.
Now, another problem that is a result of testing on firefox and
netscape, where
the html works good on IE, but not good on Firefox or Netscape.

<table width="300" border="0" align="center">

<tr align="center">
abcd
</tr>
<tris a *row*. Where is the *cell* to put the data in? You need:

<tr align="center">
<td>
abcd
</td>
</tr>

<snip rest>
This is the way I want the html to look. It is a little weird that
the major browsers do not handle the html in the same exact way.
Major browsers all handle errors in a different way. Who knows why? They
are errors! What you should be doing is writing error-free code, and
then you don't have to worry about it.

http://validator.w3.org/

--
-bts
-Warning: I brake for lawn deer
Aug 14 '06 #7

P: n/a
On 2006-08-14, en*****@hotmail.com wrote:
The &nbsp works fine in Firefox and Netscape, now that I put the ; at
the end of each one:

&nbsp;&nbsp;

Now, another problem that is a result of testing on firefox and
netscape, where
the html works good on IE,
There must be a bug in IE.
but not good on Firefox or Netscape.

<table width="300" border="0" align="center">

<tr align="center">
abcd
</tr>

<tr align="center">
1234
</tr>
<tr align="center">
XYZ9
</tr>

<td width="32%" align="center">
</td>
</table>

The above html using the <trstatement does not work in firefox or
netscape, but
works fine in IE. In firefox or netscape, the columns run together:

abcd 1234 XYZ9

This is incorrect, since I want abcd to be on a separate line (and 1234
and XYZ9 to
be on separate lines).

In IE, the html makes it look like this:

abcd
1234
XYZ9

This is the way I want the html to look. It is a little weird that
the major browsers do not handle the html in the same exact way.
Try using correctly constructed HTML.

What did the validator (http://validator.w3.org/) say about the
page? (You did check it, didn't you?)

You need to put your text in <TDelements.

--
Chris F.A. Johnson <http://cfaj.freeshell.org>
================================================== =================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Aug 14 '06 #8

P: n/a
I ran the validator on my web page and numerous errors. This will help
much. Thanks so
much you guys, for your wisdom.

E.

Aug 14 '06 #9

P: n/a
en*****@hotmail.com wrote:
I have the following line of html:

&nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nb sp;&nbsp;&nbspyow

In Internet Explorer 6.0, the columns look ok using the above html:

1234 abcd yow
But, in firefox, for same html, getting this:

&nbsp1234 &nbspabcd yow

Does anyone know why I might be getting &nbsp in the output of my
html using firefox?
Because Firefox is compliant, and IE isn't. The entity reference is
supposed to end in a semi-colon.

--
Jack.
http://www.jackpot.uk.net/
Aug 14 '06 #10

P: n/a
en*****@hotmail.com wrote:
I have the following line of html:

&nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nb sp;&nbsp;&nbspyow

In Internet Explorer 6.0, the columns look ok using the above html:

1234 abcd yow
But, in firefox, for same html, getting this:

&nbsp1234 &nbspabcd yow

Does anyone know why I might be getting &nbsp in the output of my html
using firefox?
Thanks for any advice on this.
The code is "&nbsp;". It isn't "&nbsp". The semicolons aren't just for
decoration. IE "fixes" your omissions for you, but it really shouldn't,
and the other browsers don't.
Aug 14 '06 #11

P: n/a
en*****@hotmail.com wrote:
>
The above html using the <trstatement does not work in firefox or
netscape, but works fine in IE. In firefox or netscape, the columns
run together:
No, IE is displaying it incorrectly.
>
abcd 1234 XYZ9

This is incorrect, since I want abcd to be on a separate line (and
1234 and XYZ9 to be on separate lines).
That's not incorrect; itg just isn't what you want.
>
In IE, the html makes it look like this:

abcd 1234 XYZ9

This is the way I want the html to look. It is a little weird that
the major browsers do not handle the html in the same exact way.
It's true that the major browsers don't handle HTML in the same way;
some of them are buggier than others. But It's not correct to suggest
that your snippet was an example of HTML.

In HTML, you can't put a piece of text in a table-row (<tr>) without
also enclosing it in a cell within that row.

If your HTML is incorrect, then it's understandable that different
browsers are going to deal with that brokenness differently. Or rather,
it's remarkable that any of them display anything at all other than an
error-message. HTML is the only language I know that is so tolerant of
errors.

You should be running your HTML through a validator, before coming here
to complain about supposedly broken browsers. The folks here like
nothing more than to rip bad HTML to shreds (or just to tell you how
many errors come up when *they* run it through a validator). Save
yourself the pain, and validate it yourself first.

--
Jack.
http://www.jackpot.uk.net/
Aug 14 '06 #12

P: n/a
Jack wrote:
en*****@hotmail.com wrote:
>I have the following line of html:

&nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&n bsp;&nbsp;&nbspyow

In Internet Explorer 6.0, the columns look ok using the above html:

1234 abcd yow
But, in firefox, for same html, getting this:

&nbsp1234 &nbspabcd yow

Does anyone know why I might be getting &nbsp in the output of my
html using firefox?

Because Firefox is compliant, and IE isn't. The entity reference is
supposed to end in a semi-colon.
Not entirely true.

From the W3C HTML 4.01 specification section 5.3:
"Note. In SGML, it is possible to eliminate the final ";" after a
character reference [here referring to both numeric charater references
and entity references] in some cases (e.g., at a line break or
immediately before a tag). In other circumstances it may not be
eliminated (e.g., in the middle of a word). We strongly suggest using
the ";" in all cases to avoid problems with user agents that require
this character to be present."

Yes, it is much better to always use a semi-colon. Otherwise, you must
memorize the exceptions where it is not mandatory.

--

David E. Ross
<http://www.rossde.com/>

Concerned about someone (e.g., Pres. Bush) snooping
into your E-mail? Use PGP.
See my <http://www.rossde.com/PGP/>
Aug 14 '06 #13

P: n/a
David E. Ross wrote:
Jack wrote:
>en*****@hotmail.com wrote:
>>I have the following line of html:

&nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc& nbsp;&nbsp;&nbspyow
In Internet Explorer 6.0, the columns look ok using the above
html:

1234 abcd yow
But, in firefox, for same html, getting this:

&nbsp1234 &nbspabcd yow

Does anyone know why I might be getting &nbsp in the output of my
html using firefox?

Because Firefox is compliant, and IE isn't. The entity reference is
supposed to end in a semi-colon.

Not entirely true.

From the W3C HTML 4.01 specification section 5.3: "Note. In SGML, it
is possible to eliminate the final ";" after a character reference
[here referring to both numeric charater references and entity
references] in some cases (e.g., at a line break or immediately
before a tag). In other circumstances it may not be eliminated (e.g.,
in the middle of a word). We strongly suggest using the ";" in all
cases to avoid problems with user agents that require this character
to be present."

Yes, it is much better to always use a semi-colon. Otherwise, you
must memorize the exceptions where it is not mandatory.
I'd be interested to be referred to an example of any user agent
supporting this misfeature. Does it happen?

--
Jack.
http://www.jackpot.uk.net/
Aug 14 '06 #14

P: n/a
en*****@hotmail.com wrote:
I have the following line of html:

&nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nb sp;&nbsp;&nbspyow

In Internet Explorer 6.0, the columns look ok using the above html:

1234 abcd yow
But, in firefox, for same html, getting this:

&nbsp1234 &nbspabcd yow

Does anyone know why I might be getting &nbsp in the output of my html
using firefox?
Thanks for any advice on this.

Entfred
The entity is &nbsp;

If this is tabular data it ought to be marked up that way.

However if it is not tabular, spacing is better achieved by something
like so (but with style block or sheet).

<p>
<span style="padding-left:0.5em;">1234</span><span
style="padding-left:1.2em;">abc</span><span
style="padding-left:0.7em;">yow</span>
</p>

Louise
Aug 15 '06 #15

P: n/a

en*****@hotmail.com wrote:
I have the following line of html:

&nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nb sp;&nbsp;&nbspyow

In Internet Explorer 6.0, the columns look ok using the above html:

1234 abcd yow
But, in firefox, for same html, getting this:

&nbsp1234 &nbspabcd yow

Does anyone know why I might be getting &nbsp in the output of my html
using firefox?
Thanks for any advice on this.

Entfred
When I started learning HTML I remember running into situations like
this all the time. Things that looked good in IE wouldn't look good in
Firefox and viceversa. I kept thinking it was a problem with the
browsers, when in fact, it was a problem in my code. What happens is,
responses in case of errors are not standardized by the W3
organization, so each browser handles them differently... some try to
think what you meant to do, others don't. Use the validator, once your
page 'passes' then you can check how it looks in different browsers,
not before.

Aug 15 '06 #16

P: n/a
In our last episode,
<11**********************@b28g2000cwb.googlegroups .com>,
the lovely and talented en*****@hotmail.com
broadcast on comp.infosystems.www.authoring.html:
The &nbsp works fine in Firefox and Netscape, now that I put the ; at
the end of each one:
&nbsp;&nbsp;
It is arguable that IE was excrutiatingly correct in accepting
character references without ; when the following character could
not possibly be part of the character reference. But as a practical
matter putting the ; always works in all browsers and is always correct.
Now, another problem that is a result of testing on firefox and
netscape, where
the html works good on IE, but not good on Firefox or Netscape.
<table width="300" border="0" align="center">
<tr align="center">
abcd
</tr>
Here IE is completely wrong. The only things you can put in
TR is TD or TH. Character data (i.e. "abcd") is not TD or
TH. Hence you cannot put it in TR.
--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Have an adequate day.
Aug 15 '06 #17

P: n/a
Lars Eighner wrote:
In our last episode,
<11**********************@b28g2000cwb.googlegroups .com>,
the lovely and talented en*****@hotmail.com
broadcast on comp.infosystems.www.authoring.html:
>The &nbsp works fine in Firefox and Netscape, now that I put the ; at
the end of each one:
>&nbsp;&nbsp;

It is arguable that IE was excrutiatingly correct in accepting
character references without ; when the following character could
not possibly be part of the character reference.
If I have &night, should it likewise assume I meant &nbsp;ight?
Aug 15 '06 #18

P: n/a
Rik
Harlan Messinger wrote:
Lars Eighner wrote:
>In our last episode,
<11**********************@b28g2000cwb.googlegroup s.com>,
the lovely and talented en*****@hotmail.com
broadcast on comp.infosystems.www.authoring.html:
>>The &nbsp works fine in Firefox and Netscape, now that I put the ;
at the end of each one:
>>&nbsp;&nbsp;

It is arguable that IE was excrutiatingly correct in accepting
character references without ; when the following character could
not possibly be part of the character reference.

If I have &night, should it likewise assume I meant &nbsp;ight?
Nope, it could try to match &night;, if not existing $nigh;t, if not
existing &nig;ht, and so one. Not a very great solution, but would you
rather have it match ALL the content after the &, where it will eat away
html tags, attributes, etc.? That's what it should do in occordance to the
standards (allthough some characters may be illegal in the entity name
offcourse, I'm to lazy to find out).

I did a quick test with only the following in the body:

paste&copy

Firefox 1.5, Opera 9, MSIE 6, they all interpretted as the (C). Which goes
to show they all try very hard to forgive your mistakes. MSIE is not solely
to blame here.

It's simple: If you want &night, or paste&copy, use &amp;night, or
paste&amp;copy.

The W3C validator suddenly makes a lot of sense to keep nagging about
ampersands having to be converted.

Grtz,
--
Rik Wasmus
Aug 15 '06 #19

P: n/a
In our last episode,
<4k************@individual.net>,
the lovely and talented Harlan Messinger
broadcast on comp.infosystems.www.authoring.html:
Lars Eighner wrote:
>In our last episode,
<11**********************@b28g2000cwb.googlegroup s.com>,
the lovely and talented en*****@hotmail.com
broadcast on comp.infosystems.www.authoring.html:
>>The &nbsp works fine in Firefox and Netscape, now that I put the ; at
the end of each one:
>>&nbsp;&nbsp;

It is arguable that IE was excruciatingly correct in accepting
character references without ; when the following character could
not possibly be part of the character reference.
If I have &night, should it likewise assume I meant &nbsp;ight?
No. The excruciating correct behavior would be to consider the part that
can be a character entity reference, namely &ni to be a character entity,
and to assume that the character entity reference ends with the first
character that cannot be part of a character entity reference.

&ni is a character entity reference. But no character entity reference
contains &nig, so &night might reasonably be interpreted as the same
as &ni;ght.

I'm not suggesting that it is ever a good idea to write character entity
references without ; but only that a browser which accepts character
entities without the ; is doing something reasonable and perhaps even
behaving correctly if you take HTML as a SGML application.
--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Bac'n Bits: Humans don't know it's not bacon!
Aug 15 '06 #20

P: n/a
Rik wrote:
Harlan Messinger wrote:
>Lars Eighner wrote:
>>In our last episode,
<11**********************@b28g2000cwb.googlegrou ps.com>,
the lovely and talented en*****@hotmail.com
broadcast on comp.infosystems.www.authoring.html:

The &nbsp works fine in Firefox and Netscape, now that I put the ;
at the end of each one:
&nbsp;&nbsp;
It is arguable that IE was excrutiatingly correct in accepting
character references without ; when the following character could
not possibly be part of the character reference.
If I have &night, should it likewise assume I meant &nbsp;ight?

Nope, it could try to match &night;, if not existing $nigh;t, if not
existing &nig;ht, and so one. Not a very great solution, but would you
rather have it match ALL the content after the &, where it will eat away
html tags, attributes, etc.?
What I'd like is for it to match only if it finds a valid code. If there
is no semicolon, there no valid code.

That's what it should do in occordance to the
standards (allthough some characters may be illegal in the entity name
offcourse, I'm to lazy to find out).

I did a quick test with only the following in the body:

paste&copy

Firefox 1.5, Opera 9, MSIE 6, they all interpretted as the (C). Which goes
to show they all try very hard to forgive your mistakes. MSIE is not solely
to blame here.
Interesting.
It's simple: If you want &night, or paste&copy, use &amp;night, or
paste&amp;copy.
That's certainly the safest way.
The W3C validator suddenly makes a lot of sense to keep nagging about
ampersands having to be converted.
Aug 15 '06 #21

P: n/a
Lars Eighner wrote:
In our last episode,
<4k************@individual.net>,
the lovely and talented Harlan Messinger
broadcast on comp.infosystems.www.authoring.html:
>Lars Eighner wrote:
>>In our last episode,
<11**********************@b28g2000cwb.googlegrou ps.com>,
the lovely and talented en*****@hotmail.com
broadcast on comp.infosystems.www.authoring.html:

The &nbsp works fine in Firefox and Netscape, now that I put the ; at
the end of each one:
&nbsp;&nbsp;
It is arguable that IE was excruciatingly correct in accepting
character references without ; when the following character could
not possibly be part of the character reference.
>If I have &night, should it likewise assume I meant &nbsp;ight?

No. The excruciating correct behavior would be to consider the part that
can be a character entity reference, namely &ni to be a character entity,
and to assume that the character entity reference ends with the first
character that cannot be part of a character entity reference.
In what way is the wrong behavior, an undesirable one, excruciatingly
correct? The correct behavior is: if there is no semicolon, there is no
character entity reference. (The spec notes "In SGML, it is possible to
eliminate the final ";" after a character reference in some cases (e.g.,
at a line break or immediately before a tag). In other circumstances it
may not be eliminated (e.g., in the middle of a word). We strongly
suggest using the ";" in all cases to avoid problems with user agents
that require this character to be present." So there is technically an
exception about including the semicolon, but (a) it's limited, (b) it
doesn't apply to the OP's case, and (c) it's shoddy and it's disparaged.
>
&ni is a character entity reference. But no character entity reference
contains &nig, so &night might reasonably be interpreted as the same
as &ni;ght.

I'm not suggesting that it is ever a good idea to write character entity
references without ; but only that a browser which accepts character
entities without the ; is doing something reasonable
Why is it reasonable for it to take my perfectly good ampersand,
intended to be a literal, and decide all on its own that I meant it to
be the beginning of a character reference that isn't there?

and perhaps even
behaving correctly if you take HTML as a SGML application.

Aug 15 '06 #22

P: n/a
In our last episode,
<4k************@individual.net>,
the lovely and talented Harlan Messinger
broadcast on comp.infosystems.www.authoring.html:
Lars Eighner wrote:
>In our last episode,
<4k************@individual.net>,
the lovely and talented Harlan Messinger
broadcast on comp.infosystems.www.authoring.html:
>>Lars Eighner wrote:
In our last episode,
<11**********************@b28g2000cwb.googlegro ups.com>,
the lovely and talented en*****@hotmail.com
broadcast on comp.infosystems.www.authoring.html:

The &nbsp works fine in Firefox and Netscape, now that I put the ; at
the end of each one:
&nbsp;&nbsp;
It is arguable that IE was excruciatingly correct in accepting
character references without ; when the following character could
not possibly be part of the character reference.
>>If I have &night, should it likewise assume I meant &nbsp;ight?

No. The excruciating correct behavior would be to consider the part that
can be a character entity reference, namely &ni to be a character entity,
and to assume that the character entity reference ends with the first
character that cannot be part of a character entity reference.
In what way is the wrong behavior, an undesirable one, excruciatingly
correct? The correct behavior is: if there is no semicolon, there is no
character entity reference.
When you type an ampersand you promise a character entity or numeric
character reference. When should the browser believe you? When you
write the ampersand? Or when it finds a string that identifies a
character entity but is not followed by a ;?
(The spec notes "In SGML, it is possible to
eliminate the final ";" after a character reference in some cases (e.g.,
at a line break or immediately before a tag). In other circumstances it
may not be eliminated (e.g., in the middle of a word). We strongly
suggest using the ";" in all cases to avoid problems with user agents
that require this character to be present." So there is technically an
exception about including the semicolon, but (a) it's limited, (b) it
doesn't apply to the OP's case, and (c) it's shoddy and it's disparaged.
That is advice to authors. It says nothing about what conforming browsers
should do.
Why is it reasonable for it to take my perfectly good ampersand,
intended to be a literal, and decide all on its own that I meant it to
be the beginning of a character reference that isn't there?
Because when you wrote the ampersand you promised a character entity (or
numeric character) reference. That's what ampersand means in HTML. Now if
you argue that there is no legal entity unless it ends in a ; that is
debatable. But there is no debate that writing an ampersand and expecting it
be accepted as per se an ampersand is clearly wrong.

When you write and ampersand and do not follow up with either a numeric
character or character entity reference, you have broken the rules. You
have no right to complain of whatever a browser does with erroneous markup.

--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
War on Terrorism: Okay, Unleash OUR Extreme Fundamentalists
"... all of them who have tried to secularize America, I point the finger in
their face and say, 'You helped this happen.'" --Jerry Falwell
Aug 15 '06 #23

P: n/a

Lars Eighner wrote:
No. The excruciating correct behavior would be to consider the part that
can be a character entity reference, namely &ni to be a character entity,
and to assume that the character entity reference ends with the first
character that cannot be part of a character entity reference.
Not as I understand HTML (I don't know how SGML treats this).

For HTML 4.01, the spec is fairly clear that it's the first
_whitespace_ character or beginning of a tag that marks the end of an
entity reference, not just the first character that's not matchable by
any defined entity.

I doubt if even SGML would do this, for (as you point out) it's
fundamentally ambiguous in some cases.

Aug 15 '06 #24

P: n/a
In our last episode,
<11**********************@m73g2000cwd.googlegroups .com>,
the lovely and talented Andy Dingley
broadcast on comp.infosystems.www.authoring.html:

Lars Eighner wrote:
>No. The excruciating correct behavior would be to consider the part that
can be a character entity reference, namely &ni to be a character entity,
and to assume that the character entity reference ends with the first
character that cannot be part of a character entity reference.
Not as I understand HTML (I don't know how SGML treats this).
For HTML 4.01, the spec is fairly clear that it's the first
_whitespace_ character or beginning of a tag that marks the end of an
entity reference, not just the first character that's not matchable by
any defined entity.
I doubt if even SGML would do this, for (as you point out) it's
fundamentally ambiguous in some cases.
What is clear in HTML is that & marks the beginning of a character entity
or numeric character reference. The part of the spec that you are referring
to is a note with advice to authors. That advice is always to close
character entity or numeric character references with ;.

That is advice. It is for authors. A conforming browser is perfectly
within its rights to believe an & in markup and to try as hard as it
can to interpret what follows the & as a character entity or numeric
character reference. In this case, IE tried very hard, and the
mozilla-based browsers, not so much. If you are careless with &s,
you like one behavior. If you are careless with ;s, you like the
other behavior. If you take the advice of the spec, you don't care
because it is never a problem for you.

--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
War on Terrorism: Bad News from the Sanity Front
"There's one thing ... that I do like about Rumsfeld, he's just a little bit
crazy, OK"? --Thomas Friedman, _The New York Times_
Aug 16 '06 #25

P: n/a
Lars Eighner:
What is clear in HTML is that & marks the beginning of a character entity
or numeric character reference.
<&opens an entity reference if, but not only if, the <&is in a
position where entity references are recognised and what follows
constitutes a Name token. (Character entity references on the other
hand open with <&#>, not <&>.) Name tokens consist of a Name Start
Character followed by zero or more Name Characters: in HTML4.01,
[a-zA-Z][a-zA-Z0-9.-_:]*. Entity references and character references
alike are closed in one of three ways: (1) explicitly by a Reference
Close <;>; (2) explicitly by a Record End; or (3) implicitly by a
non-Name Character.

To take the example <&night,>, in SGML-HTML, the entity reference
ends after <t>, since the comma is not a Name Character. The name
'night', however, does not correspond to a "character entity reference"
of HTML4.01.

If you don't have a copy of ISO8879 - I got my copy for $10 - point
your browser here for a list of SGML productions:
http://www.w3.org/MarkUp/SGML/productions.html

--
Jock

Aug 16 '06 #26

P: n/a

Lars Eighner wrote:
The part of the spec that you are referring
to is a note with advice to authors. That advice is always to close
character entity or numeric character references with ;.
It's an advisory note certainly (in the HTML 4 spec), but it refers to
an uncited SGML document that I understand to _require_ a syntactically
identifiable marker for "reference end", not just a failure to look it
up in a table. Perhaps someone with access to the real SGML spec can
clear this one up properly?

"Note. In SGML, it is possible to eliminate the final ";" after a
character reference in some cases (e.g., at a line break or immediately
before a tag). In other circumstances it may not be eliminated (e.g.,
in the middle of a word). We strongly suggest using the ";" in all
cases to avoid problems with user agents that require this character to
be present."

Aug 16 '06 #27

P: n/a
Lars Eighner wrote:
In our last episode, <4k************@individual.net>, the lovely and
talented Harlan Messinger broadcast on
comp.infosystems.www.authoring.html:
>Lars Eighner wrote:
>>In our last episode, <4k************@individual.net>, the lovely
and talented Harlan Messinger broadcast on
comp.infosystems.www.authoring.html:

Lars Eighner wrote:
In our last episode,
<11**********************@b28g2000cwb.googlegr oups.com>, the
lovely and talented en*****@hotmail.com broadcast on
comp.infosystems.www.authoring.html:
>
>The &nbsp works fine in Firefox and Netscape, now that I
>put the ; at the end of each one: &nbsp;&nbsp;
It is arguable that IE was excruciatingly correct in
accepting character references without ; when the following
character could not possibly be part of the character
reference.
If I have &night, should it likewise assume I meant &nbsp;ight?

No. The excruciating correct behavior would be to consider the
part that can be a character entity reference, namely &ni to be a
character entity, and to assume that the character entity
reference ends with the first character that cannot be part of a
character entity reference.
>In what way is the wrong behavior, an undesirable one,
excruciatingly correct? The correct behavior is: if there is no
semicolon, there is no character entity reference.

When you type an ampersand you promise a character entity or numeric
character reference. When should the browser believe you? When you
write the ampersand? Or when it finds a string that identifies a
character entity but is not followed by a ;?
>(The spec notes "In SGML, it is possible to eliminate the final ";"
after a character reference in some cases (e.g., at a line break
or immediately before a tag). In other circumstances it may not be
eliminated (e.g., in the middle of a word). We strongly suggest
using the ";" in all cases to avoid problems with user agents that
require this character to be present." So there is technically an
exception about including the semicolon, but (a) it's limited, (b)
it doesn't apply to the OP's case, and (c) it's shoddy and it's
disparaged.

That is advice to authors. It says nothing about what conforming
browsers should do.
What part of "it may not be eliminated" isn't clear? If the author omits
the semicolon, in the conditions cited, then the author hasn't produced
a character reference. Instead, he has coded an ampersand followed by a
string of characters, which in HTML is a conforming string of literal
characters. (See more below.) The author may have produced this string
by mistake, but that doesn't mean that the string isn't valid HTML. It
is. The user agent has no business deciding that it isn't one, just as
it has no business deciding that

Hellonbsp;there

was meant to be

Hello&nbsp;there

or that

<p>Hello brthere</p>

was meant to be

<p>Hello <brthere</p>.

The ampersand, like the semicolon and the greater-than sign, has a
special meaning in certain conditions, and in other conditions is a
literal character.
>Why is it reasonable for it to take my perfectly good ampersand,
intended to be a literal, and decide all on its own that I meant it
to be the beginning of a character reference that isn't there?

Because when you wrote the ampersand you promised a character entity
(or numeric character) reference. That's what ampersand means in
HTML. Now if you argue that there is no legal entity unless it ends
in a ; that is debatable. But there is no debate that writing an
ampersand and expecting it be accepted as per se an ampersand is
clearly wrong.

When you write and ampersand and do not follow up with either a
numeric character or character entity reference, you have broken the
rules. You have no right to complain of whatever a browser does
with erroneous markup.
As deeply as you feel about this, you're mistaken. See
http://www.w3.org/TR/html4/charset.html#h-5.3, which makes it plain that
the ampersand, like the less-than sign, the greater-than sign, and the
double quote, is a legal literal character whenever there isn't a valid
context in which to treat it as a special character. If the parser
doesn't find a valid context in which to treat it as a special
character, the parser isn't supposed to yearn to treat it as one and
invent the context in which to do so. What it's supposed to do is to
conclude that the ampersand is literal.
Aug 17 '06 #28

P: n/a
Andy Dingley <di*****@codesmiths.comscripsit:
Lars Eighner wrote:
>The part of the spec that you are referring
to is a note with advice to authors. That advice is always to close
character entity or numeric character references with ;.

It's an advisory note certainly (in the HTML 4 spec), but it refers to
an uncited SGML document that I understand to _require_ a
syntactically identifiable marker for "reference end", not just a
failure to look it up in a table.
The HTML 4 specification cites the SGML standard. The standard specifies
that under certain conditions a reference close (";") may be omitted, namely
when the reference is not immediately followed by a name character. The HTML
4 specification is vague about this, but it doesn't really matter. HTML as
an SGML application was never much more than theory and lip service.

If you write e.g.
foo&nbspbar hello world
then you have used the entity reference &nbspbar (which lacks a reference
close, which is permitted). Its meaning is undefined,

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Aug 17 '06 #29

This discussion thread is closed

Replies have been disabled for this discussion.