473,394 Members | 2,052 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,394 software developers and data experts.

Rendering "special characters" and html validation

On this page of my website: http://www.zen62775.zen.co.uk/rigs.html
the W3C html validator claims that there are some bytes it cannot interpret
in line 49 of the html source as UTF-8. If I force ISO-8859-1 encoding,
however, the page will validate correctly but displays a warning about the &
character on the same line, saying that & is the "first character of a
delimiter but occurred as data". Is there any way to remedy this
problem/issue?

Secondly, the plus-minus (plus symbol immediately above a dash) symbol on
the same line of the html source does not render on my copy of Firefox 1.0
or Internet Explorer 6.0 SP1, instead appearing as a question mark. Does
this happen on other browsers, is there any way to make this character
render correctly?
Jul 23 '05 #1
5 8690
Armand Karlsen wrote:
On this page of my website: http://www.zen62775.zen.co.uk/rigs.html
the W3C html validator claims that there are some bytes it cannot
interpret in line 49 of the html source as UTF-8. If I force ISO-8859-1
encoding, however, the page will validate correctly
What do you mean by "force ISO-8859-1 encoding"?

Obviously the page is really 8859-1; if you put the correct content-type in
the page header, you wouldn't need to force the validator to ignore the
incorrect information that's in there now. What did you hope to accomplish
by misrepresenting the encoding, anyway???
but displays a warning
about the & character on the same line, saying that & is the "first
character of a delimiter but occurred as data". Is there any way to remedy
this problem/issue?
That has nothing at all to do with encoding. Regardless of the encoding,
ampersands must be represented correctly in HTML, as "&".
Secondly, the plus-minus (plus symbol immediately above a dash) symbol on
the same line of the html source does not render on my copy of Firefox 1.0
or Internet Explorer 6.0 SP1, instead appearing as a question mark. Does
this happen on other browsers, is there any way to make this character
render correctly?


You can't really *force* anything. All you can do is provide the correct
entity for the character you want to display, which is "±". If you
have a browser that doesn't display that correctly, report the bug to that
browser's author.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Jul 23 '05 #2
"Sherm Pendley" <sp******@dot-app.org> wrote in message
news:no********************@adelphia.com...

What do you mean by "force ISO-8859-1 encoding"?

Obviously the page is really 8859-1; if you put the correct content-type in the page header, you wouldn't need to force the validator to ignore the
incorrect information that's in there now. What did you hope to accomplish
by misrepresenting the encoding, anyway???

Overriding the "default" page encoding in the W3C html validator. I had the
page in UTF-8 so I wouldn't have to juggle encodings if I were to put in
accents and other characters.

That has nothing at all to do with encoding. Regardless of the encoding,
ampersands must be represented correctly in HTML, as "&amp;".

Is there a website/page with the correct representations of such symbols?

You can't really *force* anything. All you can do is provide the correct
entity for the character you want to display, which is "&plusmn;". If you
have a browser that doesn't display that correctly, report the bug to that
browser's author.


Replacing the plus-minus in the source with &plusmn; made the symbol come up
correctly. The browsers apparently didn't understand the character directly.
Jul 23 '05 #3
Armand Karlsen wrote:
Overriding the "default" page encoding in the W3C html validator. I had
the page in UTF-8 so I wouldn't have to juggle encodings if I were to put
in accents and other characters.
That's the problem - the page *isn't* encoded in UTF-8, it's ISO-8859-1. The
"encoding" attribute you used in the page is wrong. That's why overriding
the encoding worked around the problem - you told the validator what the
correct encoding is, and told it to ignore the incorrect information it
found in the page itself.
Is there a website/page with the correct representations of such symbols?
Somewhere on the W3 site, I'd imagine... (click, click, click...) Ah, here
we go:

<http://www.w3.org/TR/html4/sgml/entities.html>
Replacing the plus-minus in the source with &plusmn; made the symbol come
up correctly. The browsers apparently didn't understand the character
directly.


The browsers I tested - Mozilla and Safari - both understand it fine, once
the encoding was declared correctly. The problem isn't the character, the
problem is that you're telling the browser the document was UTF-8, when in
fact it was 8859-1 encoded.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Jul 23 '05 #4
Sherm Pendley wrote:
Armand Karlsen wrote:
On this page of my website: http://www.zen62775.zen.co.uk/rigs.html
the W3C html validator claims that there are some bytes it cannot
interpret in line 49 of the html source as UTF-8. If I force ISO-8859-1
encoding, however, the page will validate correctly

If you're going to declare UTF-8, you had better learn how to use it
correctly.
http://lachy.id.au/blogs/log/2004/12...unicode-part-1
http://lachy.id.au/blogs/log/2004/12...unicode-part-2
http://lachy.id.au/blogs/log/2005/01...unicode-part-3
Regardless of the encoding, ampersands must be represented correctly
in HTML, as "&amp;".


Technically, not always for HTML. It is acceptable to leave both "&"
and "<" unencoded, such as when followed by a space, a new line and a
few other situations; but it is a very good practice to always encode
them anyway. In XHTML, however, you are always required to encode them
correctly.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Jul 23 '05 #5
Armand Karlsen wrote:

Is there a website/page with the correct representations of such symbols?


http://www.upsdell.com/BrowserNews/res_entities.htm
Jul 23 '05 #6

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

Similar topics

0
by: BenO | last post by:
Hi I'm new to python and need to write a function to replace certain characters in a string (html). The characters I need to replace come from MS Word copy & paste and are: ' (Left quote)...
2
by: Pawe³ | last post by:
Hello! I'm looking for efficient code or site where I can find code for finding one string in another string. String which I search should have "wild" characters like '?' for any one char and...
1
by: knocte | last post by:
Hello group. In the following testcase I attach to the final of the message, I have two questions: 1) According to comment # 1, how can I pass an argument to the function that way? 2)...
4
by: wob | last post by:
Many thanks for those who responded to my question of "putting greek char into C string". In searching for an solution, I noticed that there are more than one version of "Extended ASCII...
4
by: Jake Barnes | last post by:
Very odd. Check out this RSS feed that my PHP script just built: http://www.tagcastle.com/rss/photography.xml When I had a straight URL in the <link> tag, or the <comment> tag, then "="...
2
by: Diilb | last post by:
I am using DOM to create an rss feed. The problem I am running into is "special characters" such as é è ç. If I try adding them to the XML as character data (CData), DOM chokes and throws out...
2
by: Jens Jensen | last post by:
Hello gurus, For some reason, i need to submit an asp.net form to an asp form. Everything works as expected . the problem i'm left with is that some danish characters like Æ Ø are changed. ...
3
by: sophie_newbie | last post by:
Hi, I want to store python text strings that characters like "é" "Č" in a mysql varchar text field. Now my problem is that mysql does not seem to accept these characters. I'm wondering if there...
0
by: Jon Skeet [C# MVP] | last post by:
On Sep 30, 12:35 pm, "John Straumann" <jstraum...@hotmail.comwrote: <snip> What's the encoding of the file? That's the first important thing to know. See...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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...
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
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...

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.