You are here: Re: Decimal code or entity? « HTML « IT news, forums, messages
Re: Decimal code or entity?

Posted by Karl C. on 05/17/07 18:15

"Toby A Inkster" <usenet200703@tobyinkster.co.uk> wrote in message
news:g6rqh4-8oj.ln1@ophelia.g5n.co.uk...
> Karl C. wrote:
>
>> I'dd like to know which is the prefered code to display the umlaut mark,
>> is
>> it in decimal code &#235 or the entity &euml;?
>>
>> I have one page using iso-8859-1 where I just use the normal character
>> 'λ'
>> but the other site uses utf-8 which asks for unicode.
>
> If you're using ISO-8859-1 or UTF-8, then you can just type λ straight
> into the file -- no need to reference it in any special way. This is
> because both of those encodings include the λ character.
>
> You only need to use an entity or character reference such as &euml; or
> &#235; when you're working in an encoding that doesn't include λ. Examples
> of such encodings are US-ASCII and Shift-JIS.
>
> For example, say you're working on an HTML file in US-ASCII encoding.
> US-ASCII is a fairly old character set with support for only about 100
> printable characters. In particular, it doesn't include any characters
> with diacritic marks (a.k.a. "accents") So because you can't represent λ
> directly in the file, you can use one of HTML's methods of representing
> that character:
>
> &euml;
> &#235;
> &#xEB;
>
> That way, the file is still valid US-ASCII, as you've not directly
> included the non-US-ASCII character λ -- you've only included an ampersand
> (&) and a few other characters, all of which are valid US-ASCII
> characters.
> But an HTML User-Agent, which "mentally converts" all the files it reads
> into Unicode, will know to read the entity as λ.
>
> With regard to which you should use, it doesn't really matter except in
> some exceptional circumstances.
>
> Circumstance 1: Hexadecimal character references (ones beginning with
> "&#x") tend to have slightly poorer support in some very old browsers, so
> if you need to support those, then stick to the mnemonic entities (&euml;)
> and decimal character references (&#235;).
>
> Circumstance 2: XML only has five mnemonic character entities -- "&amp;",
> "&gt;", "&lt;", "&quot;" and "&apos;". Others can be defined, but should
> not be relied on as they require the processing agent to read the DTD to
> understand what they are. Many agents do not read the DTD (formally, they
> don't have to), so will not understand the entities. For this reason, it's
> wise to stick to only using numeric character references in XML, except
> for
> "&amp;", "&gt;", "&lt;" and "&quot;". (I leave out "&apos;" because
> Internet Explorer doesn't support it -- use "&#39;" instead.) As XHTML is
> a variety of XML, this advice applies to XHTML too.
>
> --
> Toby A Inkster BSc (Hons) ARCS
> http://tobyinkster.co.uk/
> Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux

Thanks for this informative answer, I've now decided to use &euml; to
represent 'λ'. I can only hope the three major searchengines Google, Yahoo
and MSN, respond well to it.

You've mentioned to put in the 'λ' character right away, I tried that, but
when using UTF-8 I have all the difficulties getting the page validated on
W3C, it actually stops checking the page because of these characters.
Without these 'λ' characters the page validates perfectly using XHTML
Transitional (even XHTML1.1).

I knew how to fix it, but the multiple choices to solve the same problem got
me confused, it is why I was asking which one of these alternatives would be
the prefered one.

Thanks once again!

Karl

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация