< (less than, the left angle bracket)
> (greater than, the right angle bracket)
-Greg
I remember using the decimals in stead of the entity reference has better chances (as in 100% compared to 99% or so) to work.
I can't remember where I've read that of course , anyone?
All "latin" encodings (ISO-8859-?), as well as UTF-8 share the same characters in the first 127 places, so no entities are needed to display them when using the usual 8-bit editors most of us employ. For displaying European accented characters in the 192-255 character range, the named entities are preferred and have worked since HTML 2.0. Entities in the range 160-191 are newer, and it is in respect of these that you may have read the caution, as the numbered version always works.
Eight bit encoding is limited to 256 characters (0-255), but Unicode supports a far bigger range than this, which is why you see entities like &8220; for example. I prefer to use an editor and an FTP client that supports UTF-8. Oh, and you need your server to send the appropriate header. This way you can enter every character "natively" which makes text far easier to read, especially if, like me, you like typographic niceties like "curly quotes." But that's just me.
To get back to the original question - < > " and & are part of both the HTML and XML languages, so are preferred for marking up code.
Sorry about the long post, but character encoding seems to be one of the least understood aspects of making web pages.
Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;
caffinephil posted this at 10:46 — 19th March 2008.
Use a textarea when you want the users to make edits to the code. If that's not necessary I'd suggest just put it in a block element.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.
Jack Michaelson posted this at 14:33 — 18th March 2008.
He has: 1,733 posts
Joined: Dec 1999
yep, there is. In stead of typing
'<tag>'
, you type'& #60;tag& #62;'
, without the spacesGreg K posted this at 16:19 — 18th March 2008.
He has: 2,145 posts
Joined: Nov 2003
actually, use the the following:
< (less than, the left angle bracket)
> (greater than, the right angle bracket)
-Greg
Jack Michaelson posted this at 21:41 — 18th March 2008.
He has: 1,733 posts
Joined: Dec 1999
I remember using the decimals in stead of the entity reference has better chances (as in 100% compared to 99% or so) to work.
I can't remember where I've read that of course , anyone?
Shakespeare: onclick || !(onclick)
webwiz posted this at 20:43 — 18th March 2008.
He has: 629 posts
Joined: May 2007
To the above, add "&" to replace any ampersand (&).
webwiz posted this at 04:33 — 19th March 2008.
He has: 629 posts
Joined: May 2007
Jack Michaelson raises an interesting point.
All "latin" encodings (ISO-8859-?), as well as UTF-8 share the same characters in the first 127 places, so no entities are needed to display them when using the usual 8-bit editors most of us employ. For displaying European accented characters in the 192-255 character range, the named entities are preferred and have worked since HTML 2.0. Entities in the range 160-191 are newer, and it is in respect of these that you may have read the caution, as the numbered version always works.
Eight bit encoding is limited to 256 characters (0-255), but Unicode supports a far bigger range than this, which is why you see entities like &8220; for example. I prefer to use an editor and an FTP client that supports UTF-8. Oh, and you need your server to send the appropriate header. This way you can enter every character "natively" which makes text far easier to read, especially if, like me, you like typographic niceties like "curly quotes." But that's just me.
To get back to the original question - < > " and & are part of both the HTML and XML languages, so are preferred for marking up code.
Sorry about the long post, but character encoding seems to be one of the least understood aspects of making web pages.
Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;
caffinephil posted this at 10:46 — 19th March 2008.
They have: 99 posts
Joined: Feb 2008
Thanks guys, would I be better using a text box or is that a no no?
webwiz posted this at 05:06 — 20th March 2008.
He has: 629 posts
Joined: May 2007
If you mean a textarea, well, the same issues apply. You still need to use < etc. even when displaying in a textarea.
Jack Michaelson posted this at 15:06 — 20th March 2008.
He has: 1,733 posts
Joined: Dec 1999
Use a textarea when you want the users to make edits to the code. If that's not necessary I'd suggest just put it in a block element.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.