473,396 Members | 1,799 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,396 software developers and data experts.

Problems with "&" changing to "&"

A lot of Firefox users I know, says they have problems with validation
where the ampersand sign has to be written as & to be valid. I don't
have Firefox my self and don't wont to install it only because of this,
so I hope some of you gurus can enlighten me with this :)

In what circumstances can the "&" in the source code be involuntary
changed to "&" by a browser when or other software, when editing and
uploading the file to the web server?

E.g. writing a string like "sc_project=402887&java=0&security"
is changed to "sc_project=402887&java=0&security" when the validator is
processing the code, without the editor doing the change deliberately.

TIA

--
/Arne

Proud User of SeaMonkey. Get your free copy:
http://www.mozilla.org/projects/seamonkey/
May 10 '06 #1
14 5894

Arne wrote:
A lot of Firefox users I know, says they have problems with validation


In the route from editor to server to on-line validator, just where
does Firefox (or any browser) have anything to do with it?

Your question, as stated, has too much missing from it to make any
sense.

May 10 '06 #2
In our last episode,
<4c*************@individual.net>,
the lovely and talented Arne
broadcast on comp.infosystems.www.authoring.html:
A lot of Firefox users I know, says they have problems with validation
where the ampersand sign has to be written as &amp; to be valid. I don't
have Firefox my self and don't wont to install it only because of this,
so I hope some of you gurus can enlighten me with this :)
This doesn't make any sense. & should be &amp; anywhere in any html
document unless the & is the beginning of a character reference. Validity
does not depend upon the browser, but is a property the document may or may
not have regardless of the browser. Browser should correctly translate
character references in URLs when they fetch, but so far as I know and I can
tell from testing, Firefox does that.
In what circumstances can the "&amp;" in the source code be involuntary
changed to "&" by a browser when or other software, when editing and
uploading the file to the web server?
I can't make any sense of this. Browsers shouldn't be doing anything to
files they upload, and I never heard of one that did. I'm not sure what
happens if you use a browser function to insert the contents of a file in a
textarea, but that is not the same thing as uploading a file.
E.g. writing a string like "sc_project=402887&amp;java=0&amp;security"
If you write this in a file and save it and then upload the file, the
following should not happen:
is changed to "sc_project=402887&java=0&security" when the validator is
processing the code, without the editor doing the change deliberately.

--
Lars Eighner us****@larseighner.com http://www.larseighner.com/
I have not seen as far as others because giants were standing on my shoulders.
May 10 '06 #3
Once upon a time *Andy Dingley <di*****@codesmiths.com>* wrote:
Arne wrote:
A lot of Firefox users I know, says they have problems with
validation


In the route from editor to server to on-line validator, just where
does Firefox (or any browser) have anything to do with it?

Your question, as stated, has too much missing from it to make any
sense.


Yes, I do belive it's a bit difficult to understand. :)
I'll try with an example as it is described to me.

On a remote visitor tracker site (statcounter.com) when the tracker code
that is to be pasted on a page, is generated using Firefox, the code to
copy is shown in a text box. Part of the code is what I used in my
initial post ("sc_project=402887&java=0&security"). In my browser and
also in IE, this part shows the ampersands as "&amp;".

When I look at the source code for the page where the box with the
generated code is, the ampersand shows as "&amp;amp", but when I
validate the page, the W3C validator also complains about the "&", where
the "&amp;" (or "&amp;amp") should be.

This page is HTML 4.0 Transitional with 9 errors, and most of the errors
(6-7) is because of the ampersand is not shown as "&amp;"

I know it's hard to understand this, and I for sure have no idea. I was
hoping somebody could have some theory what's happening. :)

--
/Arne

Proud User of SeaMonkey. Get your free copy:
http://www.mozilla.org/projects/seamonkey/
May 10 '06 #4
To further the education of mankind, Arne <in*****@domain.invalid>
vouchsafed:
When I look at the source code for the page where the box with the
generated code is, the ampersand shows as "&amp;amp", but when I
validate the page, the W3C validator also complains about the "&", where
the "&amp;" (or "&amp;amp") should be.


What do you mean "should be"? You just said "&amp;amp" was in the source
code. This would display "&amp" in the viewport. So where does the lone
"&" come from? (Btw, note that the "&amp" is incorrect. It should be
"&amp;".)

--
Neredbojias
Infinity has its limits.
May 10 '06 #5
Arne wrote:
Once upon a time *Andy Dingley <di*****@codesmiths.com>* wrote:
Arne wrote:
A lot of Firefox users I know, says they have problems with
validation

In the route from editor to server to on-line validator, just where
does Firefox (or any browser) have anything to do with it?

Your question, as stated, has too much missing from it to make any
sense.


Yes, I do belive it's a bit difficult to understand. :)
I'll try with an example as it is described to me.

On a remote visitor tracker site (statcounter.com) when the tracker code
that is to be pasted on a page, is generated using Firefox, the code to
copy is shown in a text box. Part of the code is what I used in my
initial post ("sc_project=402887&java=0&security"). In my browser and
also in IE, this part shows the ampersands as "&amp;".

When I look at the source code for the page where the box with the
generated code is, the ampersand shows as "&amp;amp", but when I
validate the page, the W3C validator also complains about the "&", where
the "&amp;" (or "&amp;amp") should be.

This page is HTML 4.0 Transitional with 9 errors, and most of the errors
(6-7) is because of the ampersand is not shown as "&amp;"

I know it's hard to understand this, and I for sure have no idea. I was
hoping somebody could have some theory what's happening. :)


I'm still having trouble understanding, but try this: if you have
"&amp;" in your string, and you need it to read as "&amp;" in the
browser, then you need to change it to "&amp;amp;". Not "&amp;amp", as
you wrote twice, but "&amp;amp;". "&amp;amp" will be interpreted as
"&amp", which is indeed invalid.
May 10 '06 #6
Once upon a time *Harlan Messinger* wrote:
Arne wrote:
Once upon a time *Andy Dingley <di*****@codesmiths.com>* wrote:
Arne wrote:
A lot of Firefox users I know, says they have problems with
validation
In the route from editor to server to on-line validator, just where
does Firefox (or any browser) have anything to do with it?

Your question, as stated, has too much missing from it to make any
sense.


Yes, I do belive it's a bit difficult to understand. :)
I'll try with an example as it is described to me.

On a remote visitor tracker site (statcounter.com) when the tracker code
that is to be pasted on a page, is generated using Firefox, the code to
copy is shown in a text box. Part of the code is what I used in my
initial post ("sc_project=402887&java=0&security"). In my browser and
also in IE, this part shows the ampersands as "&amp;".

When I look at the source code for the page where the box with the
generated code is, the ampersand shows as "&amp;amp", but when I
validate the page, the W3C validator also complains about the "&", where
the "&amp;" (or "&amp;amp") should be.

This page is HTML 4.0 Transitional with 9 errors, and most of the errors
(6-7) is because of the ampersand is not shown as "&amp;"

I know it's hard to understand this, and I for sure have no idea. I was
hoping somebody could have some theory what's happening. :)


I'm still having trouble understanding, but try this: if you have
"&amp;" in your string, and you need it to read as "&amp;" in the
browser, then you need to change it to "&amp;amp;". Not "&amp;amp", as
you wrote twice, but "&amp;amp;". "&amp;amp" will be interpreted as
"&amp", which is indeed invalid.


Yes, the "&amp;amp" was a typo from me, but only here. *I* can see
"&amp;amp;" in the source code of the page containing the code (in the
box) for the tracker. In the "web view" mode (the actual page) the code
in the text box shows &amp; for *me*. It's like having "&amp;" in the
page source to see "&" on the page.

But Firefox users see only "&" in the text box that and when they paste
the tracker code to their pages, the code of course don't validate. The
question is why Firefox don't show the tracker code in the box as
SeaMonkey and IE does?

The content in the text box is like plain text in Notepad, but Firefox
is transforming the &amp; to a & even if everything else is as it
should. Firefox users have to add the "amp;" manually to make it valid
code. I guess most can do it, but should not really need to when the
generator is preparing a "ready to copy" code.

And I'm just trying to figure out why this happend only on Firefox. :)

--
/Arne

Proud User of SeaMonkey. Get your free copy:
http://www.mozilla.org/projects/seamonkey/
May 10 '06 #7
Once upon a time *Lars Eighner* wrote:
In our last episode,
<4c*************@individual.net>,
the lovely and talented Arne
broadcast on comp.infosystems.www.authoring.html:
A lot of Firefox users I know, says they have problems with validation
where the ampersand sign has to be written as &amp; to be valid. I don't
have Firefox my self and don't wont to install it only because of this,
so I hope some of you gurus can enlighten me with this :)


This doesn't make any sense. & should be &amp; anywhere in any html
document unless the & is the beginning of a character reference. Validity
does not depend upon the browser, but is a property the document may or may
not have regardless of the browser. Browser should correctly translate
character references in URLs when they fetch, but so far as I know and I can
tell from testing, Firefox does that.
In what circumstances can the "&amp;" in the source code be involuntary
changed to "&" by a browser when or other software, when editing and
uploading the file to the web server?


I can't make any sense of this. Browsers shouldn't be doing anything to
files they upload, and I never heard of one that did. I'm not sure what
happens if you use a browser function to insert the contents of a file in a
textarea, but that is not the same thing as uploading a file.
E.g. writing a string like "sc_project=402887&amp;java=0&amp;security"


If you write this in a file and save it and then upload the file, the
following should not happen:
is changed to "sc_project=402887&java=0&security" when the validator is
processing the code, without the editor doing the change deliberately.

Well, you are not the only one that can't make any sense of this. But
the fact is (as it's told to me anyway) when Firefox users generate the
code(see my other posts) that is "ready to copy" for everybody else (it
seams) they have to manually add the "amp;" part after the "&" to make
it valid code.

If I should see the same in my browsers (SeaMonkey and IE) I may have
suspected e.g. the code generator script, or the firewall. But if the
error is there, why does it affect only Firefox.

If anybody with Firefox in this NG would go to www.statcounter.com and
register for an tracker account, they could see if it happends to them.
However, I don't expect anybody to do it, only because of this. I don't
install Firefox because of it. :)

--
/Arne

Proud User of SeaMonkey. Get your free copy:
http://www.mozilla.org/projects/seamonkey/
May 10 '06 #8
Arne wrote:
Well, you are not the only one that can't make any sense of this. But
the fact is (as it's told to me anyway) when Firefox users generate the
code(see my other posts) that is "ready to copy" for everybody else (it
seams) they have to manually add the "amp;" part after the "&" to make
it valid code.

If I should see the same in my browsers (SeaMonkey and IE) I may have
suspected e.g. the code generator script, or the firewall. But if the
error is there, why does it affect only Firefox.

If anybody with Firefox in this NG would go to www.statcounter.com and
register for an tracker account, they could see if it happends to them.
However, I don't expect anybody to do it, only because of this. I don't
install Firefox because of it. :)


OK, I get the point. For everyone else: StatCounter gives you code to
add a hit counter to your page, and gives you a number of options for
how it should look and operate. Once you've made your selections, it
gives you code like the following, in a TEXTAREA for some reason, so you
can copy and paste it to your web page.

<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=nnnnnn;
var sc_invisible=0;
var sc_partition=11;
var sc_security="11111111";
</script>

<script type="text/javascript" language="javascript"
src="http://www.statcounter.com/counter/counter.js"></script><noscript><a
href="http://www.statcounter.com/" target="_blank"><img
src="http://c12.statcounter.com/counter.php?sc_project=nnnnnn&java=0&security=1111 111&invisible=0"
alt="free invisible hit counter" border="0"></a> </noscript>
<!-- End of StatCounter Code -->
The above was pasted from Firefox, and you can see that the query string
for counter.php has literal ampersands ("&"). If you View Page Source,
it shows "&amp;".

In IE, the code as displayed in the TEXTAREA has the "&amp;":

src="http://c12.statcounter.com/counter.php?sc_project=nnnnnn&amp;java=0&amp;secur ity=1111111&amp;invisible=0"

View Source shows the underlying code to be "&amp;amp;".

So it looks as though Firefox is throwing in an extra round of replacements.
May 10 '06 #9
Once upon a time *Harlan Messinger* wrote:
Arne wrote:
Well, you are not the only one that can't make any sense of this. But
the fact is (as it's told to me anyway) when Firefox users generate the
code(see my other posts) that is "ready to copy" for everybody else (it
seams) they have to manually add the "amp;" part after the "&" to make
it valid code.

If I should see the same in my browsers (SeaMonkey and IE) I may have
suspected e.g. the code generator script, or the firewall. But if the
error is there, why does it affect only Firefox.

If anybody with Firefox in this NG would go to www.statcounter.com and
register for an tracker account, they could see if it happends to them.
However, I don't expect anybody to do it, only because of this. I don't
install Firefox because of it. :)


OK, I get the point. For everyone else: StatCounter gives you code to
add a hit counter to your page, and gives you a number of options for
how it should look and operate. Once you've made your selections, it
gives you code like the following, in a TEXTAREA for some reason, so you
can copy and paste it to your web page.

<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=nnnnnn;
var sc_invisible=0;
var sc_partition=11;
var sc_security="11111111";
</script>

<script type="text/javascript" language="javascript"
src="http://www.statcounter.com/counter/counter.js"></script><noscript><a
href="http://www.statcounter.com/" target="_blank"><img
src="http://c12.statcounter.com/counter.php?sc_project=nnnnnn&java=0&security=1111 111&invisible=0"
alt="free invisible hit counter" border="0"></a> </noscript>
<!-- End of StatCounter Code -->
The above was pasted from Firefox, and you can see that the query string
for counter.php has literal ampersands ("&"). If you View Page Source,
it shows "&amp;".

In IE, the code as displayed in the TEXTAREA has the "&amp;":

src="http://c12.statcounter.com/counter.php?sc_project=nnnnnn&amp;java=0&amp;secur ity=1111111&amp;invisible=0"

View Source shows the underlying code to be "&amp;amp;".

So it looks as though Firefox is throwing in an extra round of replacements.


Thank you Harlan, it's a relief to see that it really is as what's told
me and I'm sorry I could not explain it better (as you did). My English
is far from what I wish it to be. :D

Is this something that could be reported as a bug in Firefox, if it's
not done yet? If we don't have any Firefox gurus in this group. :)

--
/Arne

Proud User of SeaMonkey. Get your free copy:
http://www.mozilla.org/projects/seamonkey/
May 10 '06 #10
Harlan Messinger <hm*******************@comcast.net> wrote:
"&amp;amp" will be interpreted as "&amp", which is indeed invalid.


It's not, why would it?

--
David Håsäther
May 10 '06 #11
Once upon a time *David Håsäther* wrote:
Harlan Messinger <hm*******************@comcast.net> wrote:
"&amp;amp" will be interpreted as "&amp", which is indeed invalid.


It's not, why would it?


There is a missing semicolon (;) in the end of the second "amp", so the
first "&amp;" is interpreted as "&" followed by "amp". It was a typo
from me. :)

--
/Arne

Proud User of SeaMonkey. Get your free copy:
http://www.mozilla.org/projects/seamonkey/
May 10 '06 #12
On Wed, 10 May 2006 14:22:41 +0200 Arne <in*****@domain.invalid> wrote:

| On a remote visitor tracker site (statcounter.com) when the tracker code
| that is to be pasted on a page, is generated using Firefox, the code to
| copy is shown in a text box. Part of the code is what I used in my
| initial post ("sc_project=402887&java=0&security"). In my browser and
| also in IE, this part shows the ampersands as "&amp;".
|
| When I look at the source code for the page where the box with the
| generated code is, the ampersand shows as "&amp;amp", but when I
| validate the page, the W3C validator also complains about the "&", where
| the "&amp;" (or "&amp;amp") should be.

If you want the browser to display "&" you code "&amp;".
If you want the browser to display "&amp;" you code "&amp;amp;".
If you want the browser to display "&amp;amp;" you code "&amp;amp;amp;".

If you code "&amp;amp;amp;" it will display as "&amp;amp;".
If you code "&amp;amp;" it will display as "&amp;".
If you code "&amp;" it will display as "&".

It's supposed to do that.

If you have a free standing & all by itself in the HTML, a validator should
complain about it, even though some browsers following the principle of "be
liberal in what you accept" will show it. It may be able to tell the & is
freestanding because no alphanumerics follow it. But in some cases you
might not get what you want even on the liberal browser. The validator is
something that does not follow the "be liberal in what you accept" principle
because it's role is to detect all errors, even if they could function in
some situations.

If you write a program to translate some text where many characters that
would be encoded in special entities in HTML can be freestanding in their
own ASCII or UTF8 or other codes, that program would have to detect all
cases of characters that must be coded in HTML and code them. If I type
in some HTML in plain text <em>like this</em> the expectation is that you
will see the HTML tags if you view the plain text. So encoding this in
HTML means translating the < and > characters to &lt; and &gt; accordingly.

--
-----------------------------------------------------------------------------
| Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
| (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/ |
-----------------------------------------------------------------------------
May 10 '06 #13
David Håsäther wrote:
Harlan Messinger <hm*******************@comcast.net> wrote:
"&amp;amp" will be interpreted as "&amp", which is indeed invalid.


It's not, why would it?


If your point was to pick on my loose use of the word "valid", I won't
argue.

Other than that, it won't work as intended because it will at best be
treated as four characters rather than as a character entity reference
for a single ampersand character.
May 10 '06 #14
> Is this something that could be reported as a bug in Firefox, if it's
not done yet? If we don't have any Firefox gurus in this group. :)


You could probably report it as a bug in Firefox, but it would be
simpler and probably safer to display your code fragment inside a single
cell HTML table.

--
Steve Swift
http://www.ringers.org.uk
May 18 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: NotGiven | last post by:
I changed my POST to GET and find appended to the url, the above string. Why and what can I do to NOT have them appended? Thanks.
4
by: barney | last post by:
Hello, I' m using .NET System.Xml.XmlDOcument. When I do the following: XmlDocument xml = new XmlDocument(); xml.Load("blah"); .... xml.Save("blub"); I've got the problem that the following...
14
by: Peter Mount | last post by:
Hello I'm having trouble with " scanf("%c", &answer);" on line 20 below. When I run the program in cygwin on Windows 98SE it skips that line completely and ends the program. Does scanf have...
5
by: martin | last post by:
Hi, I would be extremly grateful for some help on producing an xml fragemt. The fragment that I wish to produce should look like this <Addresses> <Address>&qout;Somebody's Name&quot;...
6
by: Rich | last post by:
Hello, I have to create a table in an Access mdb (remotely) on the fly. Create Table tbl1(fld1 Integer, fld2 varchar(10), fld3...) Then I have to insert data: Insert Into tbl1 Values(" &...
3
by: divya | last post by:
Hi, I have a table tblbwday with 2 fields Name and Birthday.I have written this script for displaying evryday names of the people on that day. <% set objConn...
13
by: Ragnar | last post by:
Hi, 2 issues left with my tidy-work: 1) Tidy transforms a "&amp;" in the source-xml into a "&" in the tidied version. My XML-Importer cannot handle it 2) in a long <title>-string a wrap is...
3
by: Pappy | last post by:
SHORT VERSION: Python File B changes sys.stdout to a file so all 'prints' are written to the file. Python file A launches python file B with os.popen("./B 2>&^1 >dev/null &"). Python B's output...
1
by: Amith | last post by:
Here we are facing a problem which is when we pass a parameter to javascript putting '&' . Ex: &contact. In Japanese OS when we receive this parameter in the script '&' is converted to 'e'.So...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...
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
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...
0
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...

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.