|
Posted by Toby A Inkster on 03/30/07 11:28
Erwin Moller wrote:
> A few day ago I discovered that the euro-sign is not defined in all
> fontfamilies.
Browsers are *supposed* to switch fonts when they encounter a character
that does not exist in the current font. Unfortunately, Internet Explorer
is famously bad at this.
> They cannot produce the right sign no matter if I use € or the
> hexadecimal equivalent.
Yep -- it's not a problem with the way you've specified the character,
just a problem that the browser is trying to display it using a font that
doesn't contain that character.
> After a little research I found I could put font-tags around the euro-sign
> with another font-family (Arial in this case) to get the Euro sign.
If you care about the symbol being rendered correctly in legacy browsers,
then this is the best solution. Either change the fonts of your whole
page, or use a little PHP+HTML+CSS:
$str = str_replace('€',
'<acronym class="e" title="euro">€</acronym>',
$str);
With CSS:
acronym.e { border-bottom:none; font-family: "Arial"; }
If you use output buffering, then you should be able to do this with
minimal code changes.
I'm actually doing something fairly similar on a current project, but with
ampersands instead of euro-signs. I wanted them all rendered in a
particular font which has an especially nice ampersand, but didn't want
the rest of the page to appear in that font.
Also, take a look at Jukka's page on the euro sign:
http://www.cs.tut.fi/~jkorpela/html/euro.html
As far as character sets are concerned, do not worry too much. HTML
documents effectively have two character sets: the one they're transmitted
in and the one they're translated into by the browser. The one they're
translated into is always Unicode, so always includes the euro symbol. So
you just need to worry about the one they're transmitted in -- you've
chosen ISO-8859-1, which does not include the euro symbol, but all that
means is that you need to use an entity instead -- you can't just type in
a raw €.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!
Navigation:
[Reply to this message]
|